Results 1 to 5 of 5
  1. #1
    tjames is offline Novice
    Windows XP Access 2007
    Join Date
    Oct 2010
    Posts
    5

    MS Access 2007 Help

    I have two fields; Aircraft_Reg and Aircraft_Type on a form pulled out from the table (tblAircraft_Details) in MS Access 2007 as following:

    Aircraft_Reg: Aircraft_Type:

    tblAircraft_Details:


    ID /Aircraft_Reg/ Aircraft_Type
    1 / A5-EAA / A320
    2/ A5-EAB / A320
    3 / A5-EAC/ A320
    4 / A5-EAD / A320
    5/ A5-RAA/ B737
    6 / A5-RAB / B737
    7 / A5-RAC/ B737
    8/ A5-RAD/ B737
    9 / A5-GAA/ B747
    10/ A5-GAB / B747
    11 /A5-GAC/ B747


    12 / A5-GAD/ B747
    13/ A5-KAA/ A340
    14/ A5-KAB/ A340
    15 / A5-KAC/ A340
    16 / A5-KAD / A340


    When users select A5-EAA or A5-EAB or A5-EAC or A5-AED on Aircraft_Reg, I want Aircraft_Type to appear automatically as A320 , when A5-RAA or A5-RAB or A5-RAC or A5-RAD is selected as B737 , when A5-GAA or A5-GAB or A5-GAC or A5-GAD is selected as B747 and when A5-KAA or A5-KAB or A5-KAC or A5-KAD is selected as A340.


    Please help me achieve the above either with VB code or macro or query. I would appreciate if you provide me with step by step process to solve the above as I am not really good in understanding access terms!


    Thank you and best regards.

  2. #2
    SoftwareMatters is offline Access VBA Developers
    Windows XP Access 2003
    Join Date
    Mar 2009
    Location
    Dorset
    Posts
    274
    If the aircraft type is fixed then I guess you don't really want to be able to select it, write?

    This is what I would do:

    In the aircraft reg drop-down rowsource add the aircraft type.
    Then to display it I would add a textbox to the form and point the controlsource to the aircraft type column of the type drop-down.

    So in the controlsource you should put something like this:

    =[TypeFieldName].column(2)

    It is column 2 because the first column is 0.

  3. #3
    tjames is offline Novice
    Windows XP Access 2007
    Join Date
    Oct 2010
    Posts
    5
    Thanks SoftwareMatters. Yes, the aircraft type is fixed such that it is one type (A320) for aircraft reg A5-EAA, A5-EAB, A5-EAC, A5-EAD and another type (B737) for aircraft reg A5-RAA, A5-RAB, A5-RAC, A5-RAD and so on. Therefore, when users select, aircraft reg as A5-EAA the aircraft type should automatically come up as A320 and when user select A5-RAA, then aircraft type should reflect as B737...

    I remember I tried this method but didn't work. Anyway, I will keep you in the loop if it works.

  4. #4
    tjames is offline Novice
    Windows XP Access 2007
    Join Date
    Oct 2010
    Posts
    5
    Yeah this did not work. Guys, can anyone help me develop this with query? Appreciate your assistance.

  5. #5
    slave138's Avatar
    slave138 is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Oct 2010
    Location
    WI
    Posts
    233
    This assumes you haven't done anything yet:

    1. Create the drop down for the Aircraft_Reg selection. (I'm going to pretend it's called cboAirReg for the purpose of later coding).
    2. Create a text field for Aircraft_Type (which I will be refrring to as txtAirType). I would probably set the Data properties for this field to Enabled = No & Locked = Yes.
    3. In the OnChange event for cboAirReg add the following code:
    Code:
    Me.txtAirType.Value = DLookup("[Aircraft_Type]", "[tblAircraft_Details]", "[tblAircraft_Details].[Aircraft_Reg]=" & Chr(34) & Me.cboAirReg & Chr(34))

Please reply to this thread with any new information or opinions.

Similar Threads

  1. access 2007
    By Yetti in forum Access
    Replies: 2
    Last Post: 07-22-2010, 02:23 PM
  2. Replies: 6
    Last Post: 12-01-2009, 11:59 AM
  3. Replies: 0
    Last Post: 11-17-2009, 02:35 PM
  4. Replies: 32
    Last Post: 09-16-2009, 10:06 AM
  5. converting from Access 2003 to Access 2007
    By LawrenceLau in forum Access
    Replies: 6
    Last Post: 11-20-2008, 03:53 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums