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

combo boxes help

Status
Not open for further replies.

detdu

Technical User
Joined
May 23, 2003
Messages
36
Location
SE
Hi I would really like help with my combo boxes.. I have three of them.. and what i would like to do is after youve chosen a choice in these boxes you can klick a command button and get the report... but the thing is i dont know how... i started off with only two.. and the code ended up like this...

Private Sub runquery_Click()
On Error GoTo Err_runquery_Click

' set up constants and variables

Dim WClause As String
Const Rview = "acViewPreview"
Const SView = "SelectRelations" ' this is a query

' I am using a query to combine results
' from two linked tables

Const RName = "Reportname"
' this is a report
' get the parameters from the combo boxes
WClause = "[SelectRelations].[Country] = '" & Me.CountryCombo & _
"' AND [SelectRelations].[Event] = '" & Me.EventCombo & "'"

' Open the report in preview mode
DoCmd.OpenReport _
Reportname:=RName, _
View:=acViewPreview, _
Filtername:=SView, _
WhereCondition:=WClause

Exit_runquery_Click:
Exit Sub

Err_runquery_Click:
MsgBox Err.Description
Resume Exit_runquery_Click
End Sub


donno if there is anything wrong with it... but it doesnt seem like it... cause when i press the command button i get a box that says enter parameter value.. im going nuts here so i would appreciate if someone could help me.. thx :(
 
In the design of the combo boxes, how many fields do you have? Do you have an ID field and a text description field? Then what do you have in the main table that corresponds, the text description or the ID?

If you have both fields in the combo box, it may be supplying the ID while the query is looking for a text description. Try using Me.CountryCombo.Text. That, I think, will get it to supply the description.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top