Results 1 to 3 of 3
  1. #1
    Join Date
    Aug 2012
    Posts
    1

    Unanswered: MS Access 2007 HELP!!!!

    Hi All,

    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.

    Regards

    Jaytc

  2. #2
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    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 events
    I'd rather be riding on the Tiger 800 or the Norton

  3. #3
    Join Date
    Jun 2005
    Location
    Richmond, Virginia USA
    Posts
    2,763
    Provided Answers: 19
    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

    Code:
    Me.[Aircraft type] = DLookup("[Aircraft type]", "YourTableName", "[aircraft reg] = " & Me.[aircraft reg])


    'If aircraft reg is defined as Text

    Code:
    Me.[Aircraft type] = DLookup("[Aircraft type]", "YourTableName", "[aircraft reg] = '" & Me.[aircraft reg] & "'")
    [Aircraft type], YourTableName and [aircraft reg] would be replaced with the actual names of your various objects.

    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •