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

    MS Access 2007 Query Help

    I am new with MS Access and I have developed a small database which is working perfectly. But I have the following issue and I could not do it myself and I tried all the ways.

    Please find attached a jpg file "tbl&frm" containing a sample table and form for MS Access 2007. In the table tblAC_Detail, AC_Reg is my primary key because it will never be repeated in my data base.

    Now I would like to request your help on how to create a query for the following problem:

    When users select AC_Reg on the form, frmFlight_Details, I want AC_Type field (a text box) to appear automatically. For example, if users select AC_Reg as A5-AAA, then AC_Type text box should appear automatically A320-231, if A5-ABA is selected then A319-133, and if A5-AJA then B777-200LR and so on.

    Your assistance in this regard would be highly appreciated.

  2. #2
    weekend00 is offline I may not be right
    Windows XP Access 2003
    Join Date
    Aug 2010
    Posts
    1,295
    let's assume the name of the textbox for AC_reg is "AC_reg", and the name of the textbox for AC_type is "AC_type",
    in form design view,
    right click on the textbox "AC_reg", select "Build Event...",VB editor will open;
    type in following code:
    Code:
        AC_type=nz(dlookup("AC_type","tblAC_Detail","AC_reg='" & AC_reg & "'"),"")

  3. #3
    tjames is offline Novice
    Windows XP Access 2007
    Join Date
    Oct 2010
    Posts
    5
    Hi weekend00, thank you for providing me a simple solution. It worked though I have to either refresh or close the form to appear the AC_Type. But anyway, you solved my purpose and thank you once again.

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

Similar Threads

  1. Replies: 3
    Last Post: 11-17-2010, 05:21 PM
  2. Access 2007/Query issue
    By forrestapi in forum Access
    Replies: 8
    Last Post: 11-04-2010, 09:44 AM
  3. Nested Query Question Access 2007
    By databased in forum Queries
    Replies: 5
    Last Post: 10-15-2010, 07:22 AM
  4. Create a query in VBA, Access 2007
    By laavista in forum Access
    Replies: 3
    Last Post: 06-22-2010, 07:43 PM
  5. access 2007; sql query in a field?
    By cmdturk in forum Access
    Replies: 4
    Last Post: 12-16-2009, 10:25 AM

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