Bringing up entered dates...

R

Rico

Hello,
I have a bunch of records with a date field in the format
MM/DD/YY. What I want to do is create a form in the
program that allows a user to enter a month and a year and
the click a button and the program will generate a report
that shows every record that corresponds with that month
and year. I'm kinda new at this so you'll have to walk me
through most of it if you can. Thanks for your help.

Rico
 
C

chriske911

normally with something like this:

Private Sub cmdOpenReport_Click()
On Error GoTo Err_cmdOpenReport_Click

Dim stDocName As String
Dim stCriteria As String

stDocName = CStr(Nz(cmbReports.Value, ""))
If Control2.Value <= Control4.Value Then
stCriteria = "month([datefield])between " & Control2.Value & " and " &
Control4.Value
DoCmd.OpenReport stDocName, acPreview, "", stCriteria, acWindowNormal
Else
MsgBox "your error message here !!!", vbOKOnly, "Date error"
End If

Exit_cmdOpenReport_Click:
Exit Sub

Err_cmdOpenReport_Click:
MsgBox Err.Description
Resume Exit_cmdOpenReport_Click

End Sub

you'll have to change some names offcourse

grtz
 

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

Top