F
Fie
Right what I have done is...
set up a form (frmKerbside) with 2 combo boxes
- Route Number (comb20)
- Collection Type (comb21)
OK button:
Private Sub cmdOk_Click()
Me.Visible = False
End Sub
Cancel button:
Private Sub cmdCancel_Click()
DoCmd.Close acForm, Me.Name
End Sub
On from Open;
Private Sub Form_Open(Cancel As Integer)
If Not bInReportOpenEvent Then
' If we're not called from the report
MsgBox "For use from the Kerbside Report only", vbOKOnly
Cancel = True
End If
Form_Open_Exit:
Exit Sub
End Sub
The Report (rptKerbside) has record source qryKerbside
OnOpen Event is:
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 "frmKerbside", , , , , acDialog
' Cancel Report if User Clicked the Cancel Button
If IsLoaded("frmKerbside") = False Then Cancel = True
' Set public variable to false to indicate that the
' Open event is completed
bInReportOpenEvent = False
End Sub
On Close event:
Private Sub Report_Close()
DoCmd.Close acForm, "Sales By Category Dialog"
End Sub
The module code:
Option Compare Database
Option Explicit
Function IsLoaded(ByVal strFormName As String) As Boolean
' Returns True if the specified form is open in Form view or Datasheet
view.
Const conObjStateClosed = 0
Const conDesignView = 0
If SysCmd(acSysCmdGetObjectState, acForm, strFormName) <>
conObjStateClosed Then
If Forms(strFormName).CurrentView <> conDesignView Then
IsLoaded = True
End If
End If
End Function
I have a button on my Main Form (frmMain) that when clicked is set to
bring up the form frmKerbside it comes up with Complie error: variable
not defined
and the line Private Sub Report_Open(Cancel As Integer)
and
bInReportOpenEvent = True
are highlighted...
I need to declare the variable so how do I do this???
HELP
set up a form (frmKerbside) with 2 combo boxes
- Route Number (comb20)
- Collection Type (comb21)
OK button:
Private Sub cmdOk_Click()
Me.Visible = False
End Sub
Cancel button:
Private Sub cmdCancel_Click()
DoCmd.Close acForm, Me.Name
End Sub
On from Open;
Private Sub Form_Open(Cancel As Integer)
If Not bInReportOpenEvent Then
' If we're not called from the report
MsgBox "For use from the Kerbside Report only", vbOKOnly
Cancel = True
End If
Form_Open_Exit:
Exit Sub
End Sub
The Report (rptKerbside) has record source qryKerbside
OnOpen Event is:
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 "frmKerbside", , , , , acDialog
' Cancel Report if User Clicked the Cancel Button
If IsLoaded("frmKerbside") = False Then Cancel = True
' Set public variable to false to indicate that the
' Open event is completed
bInReportOpenEvent = False
End Sub
On Close event:
Private Sub Report_Close()
DoCmd.Close acForm, "Sales By Category Dialog"
End Sub
The module code:
Option Compare Database
Option Explicit
Function IsLoaded(ByVal strFormName As String) As Boolean
' Returns True if the specified form is open in Form view or Datasheet
view.
Const conObjStateClosed = 0
Const conDesignView = 0
If SysCmd(acSysCmdGetObjectState, acForm, strFormName) <>
conObjStateClosed Then
If Forms(strFormName).CurrentView <> conDesignView Then
IsLoaded = True
End If
End If
End Function
I have a button on my Main Form (frmMain) that when clicked is set to
bring up the form frmKerbside it comes up with Complie error: variable
not defined
and the line Private Sub Report_Open(Cancel As Integer)
and
bInReportOpenEvent = True
are highlighted...
I need to declare the variable so how do I do this???
HELP