F
Fie
hey..
What iv done is created a form to supply parameters to a report. Having
found how to do this on Microsoft site. The follwing code i added to
the form, which allows users to select customer name from combo box and
enter start and finsh dates.
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 the use of the Meal Uptake Report", vbOKOnly
Cancel = True
End If
Form_Open_Exit:
Exit Sub
End Sub
Private Sub OK_Click()
Me.Visible = False
End Sub
when i run the report the form pops up which i want it to do, but when
i click on the OK button and error comes up in the supporting code
module which is
Option Compare Database
Option Explicit
Public bInReportOpenEvent As Boolean ' Is report in the Open event?
Function IsLoaded(ByVal strMealUptake As String) As Boolean
' Returns True if the specified form is open in Form view or Datasheet
view.
Dim oAccessObject As AccessObject
Set oAccessObject = CurrentProject.AllForms(strMealUptake)
If oAccessObject.IsLoaded Then
If oAccessObject.CurrentView <> acCurViewDesign Then
IsLoaded = True
End If
End If
End Function
It does not seem to like "Function IsLoaded(ByVal FormName As String)
As Boolean"
I thought it might be something to do with "ByVal FormName As String"
and put in the name of my form instead of FormName but this does not
seem to work and works well with the example i downloaed....
can any1 help me pllllllleeeaasssee iv hut a brick wall and cant get
past it...
What iv done is created a form to supply parameters to a report. Having
found how to do this on Microsoft site. The follwing code i added to
the form, which allows users to select customer name from combo box and
enter start and finsh dates.
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 the use of the Meal Uptake Report", vbOKOnly
Cancel = True
End If
Form_Open_Exit:
Exit Sub
End Sub
Private Sub OK_Click()
Me.Visible = False
End Sub
when i run the report the form pops up which i want it to do, but when
i click on the OK button and error comes up in the supporting code
module which is
Option Compare Database
Option Explicit
Public bInReportOpenEvent As Boolean ' Is report in the Open event?
Function IsLoaded(ByVal strMealUptake As String) As Boolean
' Returns True if the specified form is open in Form view or Datasheet
view.
Dim oAccessObject As AccessObject
Set oAccessObject = CurrentProject.AllForms(strMealUptake)
If oAccessObject.IsLoaded Then
If oAccessObject.CurrentView <> acCurViewDesign Then
IsLoaded = True
End If
End If
End Function
It does not seem to like "Function IsLoaded(ByVal FormName As String)
As Boolean"
I thought it might be something to do with "ByVal FormName As String"
and put in the name of my form instead of FormName but this does not
seem to work and works well with the example i downloaed....
can any1 help me pllllllleeeaasssee iv hut a brick wall and cant get
past it...