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

VBA for 2 combo boxes

Status
Not open for further replies.

Cillies

Technical User
Feb 7, 2003
112
GB
Below is my code that I use for searching a query to display results on a form. The problem is that I want to add a second combo box [season], that links with the first [opponent]
(name of second combo - cboseason)

Does anyone know how I can change the code so that when I click OPEN it will search the query for the value of the combined combo boxes: opponent and season



Private Sub open_Click()
On Error GoTo Err_open_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "sbo"

stLinkCriteria = "[MAIN TABLE.OPPONENTS]=" & "'" & Me![cboopp] & "'"
DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_open_Click:
Exit Sub

Err_open_Click:
MsgBox Err.Description
Resume Exit_open_Click

End Sub
 
Something like this ?
stLinkCriteria = "[MAIN TABLE].OPPONENTS='" & Me![cboopp] & "' AND [MAIN TABLE].SEASON='" & Me![cboseason] & "'"

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Yea! I tried that but it keeps bringing up a blank form with no results. Do you know of anything else I can try.

Thanks for your patients
 
How are ya Cillies . . . . .

In the criteria provided by [blue]PHV[/blue], did you change [purple]cboseason[/purple] to the [blue]actual name[/blue] you gave the [purple]Season Combobox?[/purple]

Calvin.gif
See Ya! . . . . . .
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top