Re: Forms to supply parameters to a report

Tech-Archive recommends: Fix windows errors by optimizing your registry



Try removing the form_open code for now. I think that the
bINReportOpenEvent is probably another custom function. I have no idea what
it does other than detect if the report opened the form for input.

"Fie" <fiona.innes@xxxxxxxxxxxx> wrote in message
news:1139492915.745564.267390@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
I think i might be using the wrong code for the OnOpen/OnClose events
in the report prob code for newer versions can you help with code that
i need as it... what i have is


Form code:

Option Compare Database

Private Sub Cancel_Click()
DoCmd.Close
End Sub

Private Sub Form_Open(Cancel As Integer)
If Not bInReportOpenEvent Then
' If we're not called from the report
MsgBox "For use from the Sales By Category Report only", vbOKOnly
Cancel = True
End If
Form_Open_Exit:
Exit Sub
End Sub

Private Sub OK_Click()
Me.Visible = False
End Sub



Report code:

Option Compare Database

Private Sub Report_Close()
DoCmd.Close acForm, "Sales By Category Dialog"
End Sub

Private Sub Report_Open(Cancel As Integer)
' Set public variable to true to indicate that the report
' is in the Open event
bInReportOpenEvent = True

' Open Sales By Category Dialog
DoCmd.OpenForm "Sales By Category Dialog", , , , , acDialog

' Cancel Report if User Clicked the Cancel Button
If IsLoaded("Sales By Category Dialog") = False Then Cancel = True

' Set public variable to false to indicate that the
' Open event is completed
bInReportOpenEvent = False
End Sub


and in the querys i have:

Criteria for School Name ----> [Forms]![MealUptake]![School]
Criteria for Date ---->> Between [Forms]![Meal Uptake]![StartDate] And
[Forms]![MealUptake]![EndDate]


any ideas... on the good side.. i aint getting that errror with the
module LoL... :-)



.


Quantcast