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!

Access report/query help

Status
Not open for further replies.

fh786

Technical User
Jul 8, 2008
32
GB
Hi,

I am trying to create a report where the user inputs a start date and end date and then selects a supplier from a drop down list and this creates a report.

I have got the date bit working but how do I create a parameter box with a drop down list for the suppliers?
 
See faq702-3619 for instructions. YOu can use this for your start date selection as well.

John
 
Thanks for the link, looks interesting I will give it a go.
 
A simple question what do I change the strWhere too?

I am trying to point it to the table with the date field?
 
If Len (Me.txtFromdate & "") >0 And Len (Me.txtToDate & "") >0 Then
' entries in both
strWhere = strWhere & " AND datefield Between #" & me.txtFromDate & "# AND #" & me.txtToDate & "#"
Else If Len (Me.txtFromdate & "") >0 And Len (Me.txtToDate & "") =0 Then
' user put something in From date only
strWhere = strWhere & " AND datefield >= #" & Me.txtFromDate & "#"
Else If Len (Me.txtFromDate & "") =0 And Len (Me.txtToDate & "") > 0 Then
' user put something in to date only
strWhere = strWhere & " AND datefield <= #" & Me.txtFromDate & "#"
End If ' no need to specify anything if nothing selected

I am using the code provided by jrbarnett, I have changed the textdatefields to reflect my names but what do I changed strWhere to?
 
before code block above set strWhere to something like:

Code:
strWhere="[Supplier]='" & me!CmbYourSupplierCombo & "' "

so by the time the code has completed the criteria string will look omething like "[Supplier]='acme' AND datefield<#1/1/08#"

JB
 
I'm a bit lost now, when I use the above bit of code it does not like it.

Is there a simpler way of using queries than VB code?
 
Yes, if you don't want to learn code. See:thread68-1499545
 
when I use the above bit of code it does not like it.

you may want to be a little more descriptive about what "it doesn't like". What is the error message you get? I bet if you give a little more information someone will be able to help you get the code working.

Leslie

Have you met Hardy Heron?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top