Thread: MS Access 2007 HELP!!!!
08-24-12, 11:40 #1Registered User
- Join Date
- Aug 2012
Unanswered: MS Access 2007 HELP!!!!
I work as an Airtraffic controller at a private airport in the UK. Im am also responsible for deveoping other other areas of the business for which a decent DB would be very useful. We currently have an in house built access DB to keep track of flights in and out of the airport etc.. The main form in the DB has several fields in which to enter data, one of which is labled "Aircraft Reg"
Now, When we type the aircraft reg in to this field, the field next to it labled Aircraft type autofills with the corrct type details.
I would dearly love to know how the clever bugger who created the database achived this. I have been working very hard over the past 3 weeks trying to emulate this function in a new, totally unrelated data base.. I have tried everything and at this point suspect it probably some clever code..
Please help me someone, although in some cases I may have already tried..
Thanks in advance for any guidance offered.
08-24-12, 14:12 #2Jaded Developer
Provided Answers: 59
- Join Date
- Nov 2004
- out on a limb
look for a table that stores the registration details
alternatively, assuming you have design rights to the DB open the relevant form in design view and look at the code.
examine the combo box that you fill in for the registration, sepcifically look at the datasource. also look at the combo box's eventsI'd rather be riding on the Tiger 800 or the Norton
08-26-12, 11:49 #3Moderator
Provided Answers: 19
- Join Date
- Jun 2005
- Richmond, Virginia USA
Continuing, in the AfterUpdate event for the aircraft reg Field (although it is possible it is in the OnExit or LostFocus event) you should see the DLookup function being used to populate the Aircraft type Control on the Form, something like
'If aircraft reg is defined as Numeric
Me.[Aircraft type] = DLookup("[Aircraft type]", "YourTableName", "[aircraft reg] = " & Me.[aircraft reg])
'If aircraft reg is defined as Text
Me.[Aircraft type] = DLookup("[Aircraft type]", "YourTableName", "[aircraft reg] = '" & Me.[aircraft reg] & "'")
Also note that while the Square Brackets are required around the red portion of this bit of code
"[aircraft reg] = " & Me.[aircraft reg])
regardless of the name. It is only required, around the other names, if, and only if, they contain Spaces in their names, such as [Aircraft type].
For this reason names containing Spaces are not considered to be 'best practice,' and should be avoided. There are a number of alternatives, such as AircraftType or Aircraft_Type which do not require Spaces but leave the names easily readable.
Linq ;0)>Hope this helps!
The problem with making anything foolproof...is that fools are so darn ingenious!
All posts/responses based on Access 2003/2007