Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Filtering Combo Box Using A Field On The Form

Status
Not open for further replies.

ericpsu32

Programmer
Sep 15, 2003
47
US
Hello,

I am trying to get a combo box to filter based on another field in the form. Best way to describe this is via an auto example.

Make (lists the makes Ford, Toyota, etc)
Model (lists only the model for the make selected first)

I was going to power my drop downs with stored procedures and pass the previous field in as a parameter to the procedure, but I can't figure out how to write it in the row source field.

Any advice will be appreciated. I don't know fi this is even the best way to do it, so if you have a more creative way I am open ears as well

Thanks!!
 
I usually base it off a query and use a function to return the value in the where clause. Basic idea.

In standard module.
Public pubModel as String

Public Function ReturnModel() as String
ReturnModel = pubModel
End Function

Data source in Make combobox.
Select make from MakeModel where Model = ReturnModel()

In afterupdate of Model Combobox
pubModel = ModelCombobox.value
Requery.MakeCombobox
 
I am a bit lost...

I would be picking a customer account (BillToFilter) on the form, then from that BillTo Filter Selected, I would like to pull the Data for it.

So My make would be the BillToFilter from the form and the next drop down combo would be used to pull the invoice numbers only for that BillToFilter.

Would my module read...

Public pubBillToFilter AS String
??? What is this doing??

Public Function ReturnBillToFilter() As String
ReturnBillToFilter() = PubBillToFilter
??? This is storing the value above as the function, I think if knew what the first line was doing I would be good.
I follow the rest..., pulling from the table based on the filter.

Thanks for the response, sorry for the long time between, I am wearing a ton of hats at my company and we moved on top of that. So this is the first time I got to revisit this.
 
Public pubBillToFilter AS String
??? What is this doing??

This is a public variable in the standard module which makes it accessible from any place in the application. So, if you load this variable with a value it is available to the function and the function in turn can be used any place in the application including a query.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top