Database Management
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsDatabasesDatabase Management

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old September 17th, 2003, 09:11 PM
DrWorm's Avatar
DrWorm DrWorm is offline
Contributing User
Dev Shed Novice (500 - 999 posts)
 
Join Date: Aug 2002
Location: Queensland, Australia
Posts: 587 DrWorm User rank is Sergeant Major (2000 - 5000 Reputation Level)DrWorm User rank is Sergeant Major (2000 - 5000 Reputation Level)DrWorm User rank is Sergeant Major (2000 - 5000 Reputation Level)DrWorm User rank is Sergeant Major (2000 - 5000 Reputation Level)DrWorm User rank is Sergeant Major (2000 - 5000 Reputation Level)DrWorm User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 3 Days 11 h 38 m 48 sec
Reputation Power: 40
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!

Reply With Quote
  #2  
Old September 17th, 2003, 11:55 PM
Doug G Doug G is offline
Grumpier Old Moderator
Dev Shed God 12th Plane (10500 - 10999 posts)
 
Join Date: Jun 2003
Posts: 10,849 Doug G User rank is Major General (70000 - 90000 Reputation Level)Doug G User rank is Major General (70000 - 90000 Reputation Level)Doug G User rank is Major General (70000 - 90000 Reputation Level)Doug G User rank is Major General (70000 - 90000 Reputation Level)Doug G User rank is Major General (70000 - 90000 Reputation Level)Doug G User rank is Major General (70000 - 90000 Reputation Level)Doug G User rank is Major General (70000 - 90000 Reputation Level)Doug G User rank is Major General (70000 - 90000 Reputation Level)Doug G User rank is Major General (70000 - 90000 Reputation Level)Doug G User rank is Major General (70000 - 90000 Reputation Level)Doug G User rank is Major General (70000 - 90000 Reputation Level)Doug G User rank is Major General (70000 - 90000 Reputation Level)Doug G User rank is Major General (70000 - 90000 Reputation Level)Doug G User rank is Major General (70000 - 90000 Reputation Level) 
Time spent in forums: 1 Month 23 h 58 m 10 sec
Reputation Power: 766
SELECT a.column1, a.column2, b.joincolumn
FROM tableA a, tableB b
WHERE b.myID = a.MyTableAID

Reply With Quote
  #3  
Old September 18th, 2003, 01:35 AM
DrWorm's Avatar
DrWorm DrWorm is offline
Contributing User
Dev Shed Novice (500 - 999 posts)
 
Join Date: Aug 2002
Location: Queensland, Australia
Posts: 587 DrWorm User rank is Sergeant Major (2000 - 5000 Reputation Level)DrWorm User rank is Sergeant Major (2000 - 5000 Reputation Level)DrWorm User rank is Sergeant Major (2000 - 5000 Reputation Level)DrWorm User rank is Sergeant Major (2000 - 5000 Reputation Level)DrWorm User rank is Sergeant Major (2000 - 5000 Reputation Level)DrWorm User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 3 Days 11 h 38 m 48 sec
Reputation Power: 40
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?

Reply With Quote
  #4  
Old September 30th, 2003, 08:51 PM
DrWorm's Avatar
DrWorm DrWorm is offline
Contributing User
Dev Shed Novice (500 - 999 posts)
 
Join Date: Aug 2002
Location: Queensland, Australia
Posts: 587 DrWorm User rank is Sergeant Major (2000 - 5000 Reputation Level)DrWorm User rank is Sergeant Major (2000 - 5000 Reputation Level)DrWorm User rank is Sergeant Major (2000 - 5000 Reputation Level)DrWorm User rank is Sergeant Major (2000 - 5000 Reputation Level)DrWorm User rank is Sergeant Major (2000 - 5000 Reputation Level)DrWorm User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 3 Days 11 h 38 m 48 sec
Reputation Power: 40
Found the answer. I needed to use the DLookup() function to select the field from the query that I wanted to display.

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesDatabase Management > Access - Display field from alternative table


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway