Dual Combo

  • Thread starter Thread starter dan
  • Start date Start date
D

dan

I have a form based off a query. I have a combo box which
I use to look up a date. I want to have a second combo box
to pull a person from that date. How do I go about this.
One Table
 
Hi, Dan.

Set the 2nd combo box' Row Source to an appropriate SQL
statement, using the value in the 1st box as criteria.
I've assumed the Date field's name is WorkDate and the
Name field is StaffMember (Date and Name are reserved
words).

Dim strSelect As String
Dim strCrit As String
strSelect = "SELECT [tblname].[StaffMember] FROM tblname "
strCrit = "Where WorkDate = " & Me!1stcomboboxname & ";"
Me!2ndcomboboxname.RowSource = strSelect & strCrit

HTH
Kevin Sprinkel
 
Comob1 is working WDate. I have the code below inthe event
procedure of after update. Should anything be in the
RowSourceType? Not quite sure on how to do the SQL
Statment.
-----Original Message-----
Hi, Dan.

Set the 2nd combo box' Row Source to an appropriate SQL
statement, using the value in the 1st box as criteria.
I've assumed the Date field's name is WorkDate and the
Name field is StaffMember (Date and Name are reserved
words).

Dim strSelect As String
Dim strCrit As String
strSelect = "SELECT [tblname].[StaffMember] FROM tblname "
strCrit = "Where WorkDate = " & Me!1stcomboboxname & ";"
Me!2ndcomboboxname.RowSource = strSelect & strCrit

HTH
Kevin Sprinkel
-----Original Message-----
I have a form based off a query. I have a combo box which
I use to look up a date. I want to have a second combo box
to pull a person from that date. How do I go about this.
One Table
.
.
 
Since you're getting the combo box' rows from a table, the
RowSourceType should be set to Table/Query.

Re: the SQL: In the code below, replace my example
descriptors to the names of your tables fields, and
controls:

Example Replace With
=======================================================
tblname Your table source for the rows of 2nd CBox
StaffMember Your person fieldname in tblname
WorkDate Your date fieldname in tblname
1stcomboboxname Name of 1st combo box
2ndcomboboxname Name of 2nd combo box

Remember, *control* names are different than the fields to
which they are bound. By default, Access names combo
boxes Combo1, Combo2, etc. Most developers use naming
conventions for controls; typically the field name
preceded by a three-letter prefix that identifies the type
of control-txt for textbox, cbo for combo box, etc., e.g.

cboWDate

HTH
Kevin Sprinkel
-----Original Message-----
Comob1 is working WDate. I have the code below inthe event
procedure of after update. Should anything be in the
RowSourceType? Not quite sure on how to do the SQL
Statment.
-----Original Message-----
Hi, Dan.

Set the 2nd combo box' Row Source to an appropriate SQL
statement, using the value in the 1st box as criteria.
I've assumed the Date field's name is WorkDate and the
Name field is StaffMember (Date and Name are reserved
words).

Dim strSelect As String
Dim strCrit As String
strSelect = "SELECT [tblname].[StaffMember] FROM tblname "
strCrit = "Where WorkDate = " & Me!1stcomboboxname & ";"
Me!2ndcomboboxname.RowSource = strSelect & strCrit

HTH
Kevin Sprinkel
-----Original Message-----
I have a form based off a query. I have a combo box which
I use to look up a date. I want to have a second combo box
to pull a person from that date. How do I go about this.
One Table
.
.
.
 
Back
Top