Pulling data between 2 date controls & check boxes

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I'm trying to design a report that will pull
data from scheduled trips.
What I have:
controls: "start date" "end date"
check boxes" "sun" "mon" "tue" "wed" "thu" "fri" "sat"
I'd like to:
1. run a report just for today
2. run a report that includes today + 6 days out
Any help will be greatly appreciated
Running Access 2000
Tom
 
Maybe an option group would work best. Example name of the option group:
"grpRange"
There would be two options:
Today (Option value of 1)
Today and the Next 6 Days (option value of 2)


Have one command button to run the report. The on-click event of the command
button would have something like:

Private Sub cmdOpenReport_Click()
On Error GoTo Err_cmdOpenReport_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "yourreport"

Select Case grpRange

Case 1

stLinkCriteria = "[yourdatefield] = #" & Date & "#"

Case 2

stLinkCriteria = "[yourdatefield] Between #" & Date & "# AND #"
& Date + 7 & "#"

End Select

With DoCmd
.OpenReport stDocName, acViewPreview, , stLinkCriteria
.Maximize
.RunCommand acCmdFitToWindow
End With

Exit_cmdOpenReport_Click:
Exit Sub

Err_cmdOpenReport_Click:
MsgBox Err.Description
Resume Exit_cmdOpenReport_Click

End Sub


JohnC
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top