Link Pulldown to Query

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi. I want to use a pull down menu to select data that will then be used to
run a query. The selected pull down data will act as a filter limiting the
results of the query. My problem is I don't know how to do that.

I have a form setup. I have the pull down setup. And I have the pull down
reading the selection data from a Access table. The selected data is one
field in another table that will be used to filter the query results. Any
guidance you can provide on how to link what was selected from the pull down
list to the query is greatly appreciated.
 
Roxie, Roxie, Roxie! Thank you so very much. I pulled my hair out for hours
trying to figure out how to link the pull down criteria to the query and you
nailed it buddy. Thanks a mil.

Roxie Aho said:
Eroomra said:
Hi. I want to use a pull down menu to select data that will then be used to
run a query. The selected pull down data will act as a filter limiting the
results of the query. My problem is I don't know how to do that.

I have a form setup. I have the pull down setup. And I have the pull down
reading the selection data from a Access table. The selected data is one
field in another table that will be used to filter the query results. Any
guidance you can provide on how to link what was selected from the pull down
list to the query is greatly appreciated.

You haven't given much detail so anybody who answers will be making a lot of
assumptions. The following code in the After Update event of a Combo Box
selects one company from a table of companies.
Sub cmbFindCompany_AfterUpdate()
' Find the record that matches the control.
Me.RecordsetClone.FindFirst "[VendorID] = " & Me![cmbFindCompany]
Me.Bookmark = Me.RecordsetClone.Bookmark
End Sub

Another scenario is a selection in a Combo Box on one form acting as the
criteria in a query. Code would look something like this, the name of the
control in this case is txtUserName from a Text Box but could be the value
from a Combo Box.
[Forms]![frmLogin]![txtUsername]

Roxie Aho
roxiea at usinternet.com
 
Eroomra said:
Hi. I want to use a pull down menu to select data that will then be used to
run a query. The selected pull down data will act as a filter limiting the
results of the query. My problem is I don't know how to do that.

I have a form setup. I have the pull down setup. And I have the pull down
reading the selection data from a Access table. The selected data is one
field in another table that will be used to filter the query results. Any
guidance you can provide on how to link what was selected from the pull down
list to the query is greatly appreciated.

You haven't given much detail so anybody who answers will be making a lot of
assumptions. The following code in the After Update event of a Combo Box
selects one company from a table of companies.
Sub cmbFindCompany_AfterUpdate()
' Find the record that matches the control.
Me.RecordsetClone.FindFirst "[VendorID] = " & Me![cmbFindCompany]
Me.Bookmark = Me.RecordsetClone.Bookmark
End Sub

Another scenario is a selection in a Combo Box on one form acting as the
criteria in a query. Code would look something like this, the name of the
control in this case is txtUserName from a Text Box but could be the value
from a Combo Box.
[Forms]![frmLogin]![txtUsername]

Roxie Aho
roxiea at usinternet.com
 
Roxie:

Your reply to Eroomra was very helpful to me for the first half of my
quandry; so, maybe you can help me with the second half...

I have a main form (frmProjectDetail) with a search feature based on a combo
box with the Event Procedure info you supplied. It successfully takes me to
the appropriate form record based on the text value in the combo box
(cmbFindProject), but only as long as the value currently exists. If the
value is not in the comb box list, I want it to go to a new record on the
form. I had a macro to do just that set up in the properties under "On Not
in List", but it doesn't seem to even look at that command after the
"AfterUpdate" pointing to the Event Procedure verbiage you provided. HELP!
I appreciate any guidance you (or anyone else) can give. Thanks!

Roxie Aho said:
Eroomra said:
Hi. I want to use a pull down menu to select data that will then be used to
run a query. The selected pull down data will act as a filter limiting the
results of the query. My problem is I don't know how to do that.

I have a form setup. I have the pull down setup. And I have the pull down
reading the selection data from a Access table. The selected data is one
field in another table that will be used to filter the query results. Any
guidance you can provide on how to link what was selected from the pull down
list to the query is greatly appreciated.

You haven't given much detail so anybody who answers will be making a lot of
assumptions. The following code in the After Update event of a Combo Box
selects one company from a table of companies.
Sub cmbFindCompany_AfterUpdate()
' Find the record that matches the control.
Me.RecordsetClone.FindFirst "[VendorID] = " & Me![cmbFindCompany]
Me.Bookmark = Me.RecordsetClone.Bookmark
End Sub

Another scenario is a selection in a Combo Box on one form acting as the
criteria in a query. Code would look something like this, the name of the
control in this case is txtUserName from a Text Box but could be the value
from a Combo Box.
[Forms]![frmLogin]![txtUsername]

Roxie Aho
roxiea at usinternet.com
 
Back
Top