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!

Report Sort/Filter 1

Status
Not open for further replies.

Drake12

Technical User
Feb 5, 2003
32
0
0
US
I made a couple of new reports and need to know how to print out date ranges? I need to pull out one week of data at a time and print it out. My other report is just a daily report of all the data entered that day. Where would select just todays date and print that data out?

Thanks
 
Ah ok , yes I did try it and I get no errors yet I get no results either. I setup a combo box that relies on the table with the BLOCK field. The combo box has all the blocks on the selector that currently in the table. I created a command button with the code you provided and when I select a block and hit the command button nothing happens. No errors but no results. The result should be "Block Summary Report" with whatever block I select from the combo box, but that is not happening.

I have fouled something up, but have yet to figure out what.
 
Please provide your latest code. What do you mean by "nothing happens"? Do you get a blank report? Do you get no report?

Duane
MS Access MVP
Find out how to get great answers faq219-2884.
 
Private Sub cboBLOCK_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 = "Block Summary Report"
strField = "BLOCK"
strWhere = "1=1 "
If Not IsNull(Me.cboBLOCK) Then 'block combo box
strWhere = strWhere & " AND [BLOCK] = """ & Me.cboBLOCK & """"
End If

' Debug.Print strWhere 'For debugging purposes only.
DoCmd.OpenReport strReport, acViewPreview, , strWhere
Me.Visible = False
End Sub




Private Sub Command1_Click()
DoCmd.Close acForm, Me.Name
End Sub


Thats the entire code for the form. I get no report.
 
I wouldn't have the code in the On Click event to the combo box. You could use the After Update event of the combo box or create a separte command button to open the report. Try change you code by adding a line:

MsgBox "strWhere Value: " & strWhere
DoCmd.OpenReport strReport, acViewPreview, , strWhere
Me.Visible = False
End Sub


Duane
MS Access MVP
Find out how to get great answers faq219-2884.
 
Just getting back to this project.

Should I use my current code in an after update event of the combo box and add the code you listed? Or where should I use the code you list?
 
Where you run the code depends on when you want something to happen. I usually add a command button and place code in the On Click event.

Duane
MS Access MVP
Find out how to get great answers faq219-2884.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top