|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
||||
|
||||
|
Access - Display field from alternative table
I think this should be an easy Access task but I just can't figure out how to do it.
Basically I have a form for the fields in TableA. One of the fields holds the ID for the fields in TableB. Naturally I can display the ID in a text box in the form but how do I display a field from TableB based on the ID I have? I've tried using a query in the control source but I can't get it to work. Any advise would be appreciated.
__________________
Ooh, they have the Internet on computers now! |
|
#2
|
|||
|
|||
|
SELECT a.column1, a.column2, b.joincolumn
FROM tableA a, tableB b WHERE b.myID = a.MyTableAID |
|
#3
|
||||
|
||||
|
Thanks for the response, though I'm familiar with how to query the information I want. It's displaying it in the form I'm having trouble with. Queries don't seem to work. I should have mentioned this earlier.
This is the SQL query I defined Code:
SELECT buildings.building FROM buildings WHERE (([buildings]![building_id]=[Forms]![asset_details_tabbed]![building_id])) GROUP BY buildings.building; The query works. But when I put it in the control source for the textbox it gives "#Name?". I can only think of two reasons why this would happen. a) The query doesn't belong in the "control source". b) textboxes won't display results from queries, maybe because of the possibility of multiple results. In which case, it's a type mismatch. Anyone have any ideas on how to correct this? |
|
#4
|
||||
|
||||
|
Found the answer. I needed to use the DLookup() function to select the field from the query that I wanted to display.
|
![]() |
| Viewing: Dev Shed Forums > Databases > Database Management > Access - Display field from alternative table |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|