If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > PC based Database Applications > Microsoft Access > Combo box to query, displayed in text box.

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 12-07-09, 04:04
ron_j_m2002 ron_j_m2002 is offline
Registered User
 
Join Date: Dec 2009
Posts: 8
Combo box to query, displayed in text box.

Hello all,
I fairly new to access and am working on a project.
What I need is a combo box that supplies data to a query, and then display the results of the query in a text box.
I have the combo box and query working properly, I just dont know how to get the query to show up in the text box once something is selected in the combo box.
Any suggestions?

Thanks
Ron
Reply With Quote
  #2 (permalink)  
Old 12-07-09, 05:30
MStef-ZG MStef-ZG is offline
Registered User
 
Join Date: Apr 2005
Location: Zagreb - Croatia
Posts: 344
Link your form on this query.
Reply With Quote
  #3 (permalink)  
Old 12-07-09, 08:54
ron_j_m2002 ron_j_m2002 is offline
Registered User
 
Join Date: Dec 2009
Posts: 8
I linked the entire form to the query, but nothing different happens.
Let me try to explain my circumstances a little better.

Lets say I'm working with a music database.
Table1 is Artists containing the artistid and artist
Table2 is Tracks containing trackid artistid and songtitle

I have form1 with a combobox that pulls its contents from Artist table and displays the artists

I have a query that displays the songtitle's for all the songs that is by the selected artist from the combo box.

What I need is a text box to filled with the results of the query whenever the combo box is changed.

For example if i select Michael Jackson in the combo box, the text box may contain Thriller, Beet It, and Billy Jean. If I move to a different artist the combo box needs to then display that data.

Any ideas?
Reply With Quote
  #4 (permalink)  
Old 12-07-09, 10:26
ron_j_m2002 ron_j_m2002 is offline
Registered User
 
Join Date: Dec 2009
Posts: 8
Ive gotten this to work a little bit using the dlookup function.
The problem I am having is that it only will display 1 result.

I need it to display every result in the query.

Any ideas on how to accomplish this?
Reply With Quote
  #5 (permalink)  
Old 12-08-09, 02:19
MStef-ZG MStef-ZG is offline
Registered User
 
Join Date: Apr 2005
Location: Zagreb - Croatia
Posts: 344
Send a short example of your mdb. Access 2000 or 2002.
Reply With Quote
  #6 (permalink)  
Old 12-08-09, 17:38
ron_j_m2002 ron_j_m2002 is offline
Registered User
 
Join Date: Dec 2009
Posts: 8
I got this figured out somewhat.

What I did was add a select query to the row source of my text box and then use some VBA to make it refresh.
Code:
Private Sub Combo_AfterUpdate()

    Me.lstResults.Requery

End Sub
The problem I am having now is trying to add an "ALL" to my combo box that selects all records, but I will start another thread for that.

Thanks
Ron
Reply With Quote
Reply

Tags
combo box, query, text box

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On