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!

Multiple Combo boxes on one form

Status
Not open for further replies.

Drake12

Technical User
Feb 5, 2003
32
0
0
US
I posted this over in reports but I really needed to post it here.

What I am trying to accomplish is this: I need the user to input a date range, then pick a harvester from a list [HARV], and finally enter a decimal number which will be stored in [CHAPPXX] and used in a formula from the fruit/query table. Here is the code I have so far .. It only includes picking a harvester at this point because I cannot figure out how to incorporate that rest of the code.

Private Sub Command0_Click()
Dim strReport As String 'Name of report to open.
Dim strField As String 'Name of your date field.
Dim strWhere As String 'Where condition for OpenReport.
strReport = "Contractor's Weekly Summary Report"
strField = "HARV"
' Debug.Print strWhere 'For debugging purposes only.
If Not IsNull(Me.cboHARV) Then 'block combo box
strWhere = "[HARV] = """ & Me.cboHARV & """"
End If

DoCmd.OpenReport strReport, acViewPreview, , strWhere
Me.Visible = False
End Sub

I have used a date range before but when I add it to this code it just gives me syntax errors or compile errors. I need to name the strings something else or really I do not know what I need to do! I need help!!

Thank You
 
I have used a date range before but when I add it to this code it just gives me syntax errors or compile errors
Feel free to post the date stuff

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
This FAQ faq181-5497 contains a function that will do what you want (i.e. returns the Where clause without the word Where). It handles list boxes, combo boxes, text boxes, ranges, option groups, and check boxes. You only have to do 3 things to make it work.

1. Create a new module and highlight and copy the function from the FAQ and paste it into you new module.

2. Set the Tag property of each of your fields as specified in the FAQ.

3. Open your report as specfied in the FAQ
 
Is HARV your date field? If so, try...

strWhere = "[HARV] = #" & Me.cboHARV & "#
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top