Bringing up entered dates...

  • Thread starter Thread starter Rico
  • Start date Start date
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
 
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
 
Back
Top