Results 1 to 4 of 4
  1. #1
    smjacb is offline Novice
    Windows XP Access 2010 32bit
    Join Date
    Apr 2014
    Posts
    2

    Help how to do a querry to select another field

    OK be patient with me I am WAY over my head

    I have 2 tables - I have a form that populates one table and uses the Primary Key number (auto populated) of the other table. I need a query that takes the value in table 1 and returns the text that corresponds to in table 2 - a simple substitution



    so table one

    pk id, type (this is the pk of table 2)

    table two

    pk id (which is type of table one), name of type

    I need a query that looks at the type of table one locates it in table two and gives me the name

    clear as mud ?

    smjacb

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,772
    So you are saving the PK ID of table 2 into field of table 1? You just want to display the associated descriptive text on form?

    Options in order of preference:

    1. a multi-column combobox, properties:
    RowSource: SELECT [pk id], type FROM table2 ORDER BY type;
    BoundColumn: 1
    ColumnCount: 2
    ColumnWidths: 0";1.0"

    2. form RecordSource is a query or sql statement that joins the tables with join type: "Include all records from table1 and only those from table2 that match"
    Bind textbox to the type field from table2 and set it Locked Yes, TabStop No

    3. DLookup function expression in textbox ControlSource
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    smjacb is offline Novice
    Windows XP Access 2010 32bit
    Join Date
    Apr 2014
    Posts
    2
    Ok #1 I am familar with because I used combo boxes for my form to enter information.

    What I am doing is very much like a recipe ...

    I have a form that I enter the ingredients and quantity in
    that populates my recipe table - and it puts the pk of my ingre table

    What I want to do now is have a query table that has name, ingre, cost

    so I need to have the name of the ingr that is indicated in my query. So if it says "1" then looking it up and give me the name of what "1" is. I really want to understand what I'm doing because of course the next hurdle would be calc field take this much of "1" and multi it by that corresponding cost which is the next column over.. isnt there a way to cross reference easy... I am an excel gal but having trouble getting accurate info in excel because I have lots of help that dont enable content and put info in the wrong place. Really need them just to enter info on the form ...

    Thanks!

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,772
    That is option 2. Join tables in query. This will make associated info of both tables available for the calcs you describe.

    Use query for form or report RecordSource.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

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

Similar Threads

  1. querry or report
    By kamnjoro in forum Access
    Replies: 1
    Last Post: 01-09-2014, 12:36 PM
  2. Replies: 3
    Last Post: 12-14-2013, 12:32 PM
  3. Replies: 1
    Last Post: 01-27-2013, 11:03 PM
  4. Replies: 1
    Last Post: 10-08-2012, 09:01 AM
  5. Replies: 5
    Last Post: 12-18-2011, 09:12 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