Dispalying Cbo Box Values

T

Tamer

Hi all,
I have an Access2K form that has several cbo boxes. I want
to do the following:
When selecting a value from the first cbo box, the list
generated in the following cbo box should be based on the
value selected from the first cbo box.

Is it possible to include an SQL parameter with a "WHERE"
clause to perform this in the event procedure? If yes, how
to do this? If no, what other way will allow to do it?
 
G

Guest

Here's some sample code which may help.

Private Sub cboByState_AfterUpdate()
Dim Q$
If Not IsNull(cboByState) Then
Q = "SELECT SSN, Last, First, Addee, City, State, Zip FROM " _
& "MainData WHERE State Like """ & cboByState & """" _
& "ORDER BY Last, First;"
lblRMS.Caption = "Names For " & cboByState & ":"
lblRMS.Visible = True: cboRMS.Visible = True
cboRMS.RowSource = "": cboRMS.RowSource = Q
cboRMS.SetFocus: cboRMS.Dropdown
cmdPatStates.Enabled = True
Else
lblRMS.Visible = False: cboRMS.Visible = False
cmdPatStates.Enabled = False
End If
End Sub

HTH - Bob
 
T

Tamer

Thank you. It worked.
-----Original Message-----
Yes - this is possible and very commonly done. Here are two articles that
explain how to do this:

How to Synchronize Two Combo Boxes on a Form
http://support.microsoft.com/default.aspx?scid=kb;EN- US;289670

ACC: How to Synchronize Two Combo Boxes on a Form (97624)
http://support.microsoft.com/default.aspx?scid=kb; [LN];97624


--
Sandra Daigle
[Microsoft Access MVP]
For the benefit of others please post all replies to this newsgroup.

Hi all,
I have an Access2K form that has several cbo boxes. I want
to do the following:
When selecting a value from the first cbo box, the list
generated in the following cbo box should be based on the
value selected from the first cbo box.

Is it possible to include an SQL parameter with a "WHERE"
clause to perform this in the event procedure? If yes, how
to do this? If no, what other way will allow to do it?

.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top