Open a report based upon a form

BoroLee

Registered User.
Local time
Today, 11:49
Joined
Aug 30, 2000
Messages
90
Private Sub Command4_Click()
On Error GoTo Err_Command4_Click

DoCmd.SetWarnings False
DoCmd.OpenReport ("R_Standard Monitoring Report"), acViewPreview, , "[T_Formatted data]![Period] = Me.Period.Value"


Exit_Command4_Click:
Exit Sub

Err_Command4_Click:
MsgBox Err.Description
Resume Exit_Command4_Click

I have written the above code which is supposed to filter out records on the report. However, when i click on my OK box, it asks me for a vlaue for the field Me. Period.Value.

Any ideas why this may be ?????

The field on the form which contains the data for the filter is called Period.
 
Just a guess:

Dim myFilter as Variant
Dim myPeriod as Variant

myPeriod = Me.Period
MyFilter = "[Period] = '" & myPeriod & "'"

DoCmd.OpenReport ("R_Standard Monitoring Report"), acViewPreview, , myFilter
 
What OK button?
 

Users who are viewing this thread

Back
Top Bottom