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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

repost

Status
Not open for further replies.

NewStudent

Programmer
Nov 8, 2002
12
0
0
IR
Hi, everyone,

How to created combox depend on other combox? I already created one cobox that works for single search. I want to create another combox "cbxDOB" that depend on "cbxlname".

The following codes only works for single search "cbxlname". Finally, I need to get search for " lastname + DOB".

Private Sub cbxlname_AfterUpdate()
Dim strSQL As String
strSQL = "select * From hackney_log where lastname = '" & Me.cbxlname & "'"
Me.RecordSource = strSQL

Me.cbxpermit = Null
Me.Requery

End Sub

Many thanks.
Wendy
 
I have done this by:
Let's say combobox #1 is called warehouse
and combobox #2 is called itemno

in combobox #2 I include in the rowsource column #1 (if you are wanting to filter CB#2 with the value in CB#1 there must be some kind of a relationship here) This field can have a 0 width so that it does not show in the CB#2.
Then in the criteria for CB#2 put under the CB#1 column me.warehouse

Then in the onclick event for CB#1, I put in a me.itemno.requery

Hope this helps
 
I would also take a look at the sample Access file included with access called Northwind. One of the programs in there has exactly what you're looking for.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top