G
Guest
yup,
i am using the following code on a form i designed to let the user specify
their parameters for a report, i.e.
Private Sub CloseForm_Click()
Dim stDocName As String
If CurrentProject.AllReports("Patients on Follow-Up").IsLoaded = True Then
stDocName = "Patients on Follow-Up"
DoCmd.Close acReport, stDocName, acSaveNo
DoCmd.Close acDefault, , acSaveNo
Else: DoCmd.Close acDefault, , acSaveNo
End If
End Sub
the code is behind the click event of a 'CloseForm' button -- i figured i'd
rig this button to test for whether or not the user's actually previewing the
report on his screen. what i want is for the button to close the report AND
then to close the form on which the button resides when the condition's true.
when it's not (as in when the user for some reason decided not to even
preview the form), all i want to happen is for the form to close.
in the second instance it works just fine.
in the first, it closes the report, it closes the switchboard that brought
the user to the form, and it leaves the form on the screen. if you next click
the same 'CloseForm' button a 2nd time, then it closes the form, leaving you
with noting on the screen (but the grey image).
can anybody help me wrap my mind around what's happening?
-ted
i am using the following code on a form i designed to let the user specify
their parameters for a report, i.e.
Private Sub CloseForm_Click()
Dim stDocName As String
If CurrentProject.AllReports("Patients on Follow-Up").IsLoaded = True Then
stDocName = "Patients on Follow-Up"
DoCmd.Close acReport, stDocName, acSaveNo
DoCmd.Close acDefault, , acSaveNo
Else: DoCmd.Close acDefault, , acSaveNo
End If
End Sub
the code is behind the click event of a 'CloseForm' button -- i figured i'd
rig this button to test for whether or not the user's actually previewing the
report on his screen. what i want is for the button to close the report AND
then to close the form on which the button resides when the condition's true.
when it's not (as in when the user for some reason decided not to even
preview the form), all i want to happen is for the form to close.
in the second instance it works just fine.
in the first, it closes the report, it closes the switchboard that brought
the user to the form, and it leaves the form on the screen. if you next click
the same 'CloseForm' button a 2nd time, then it closes the form, leaving you
with noting on the screen (but the grey image).
can anybody help me wrap my mind around what's happening?
-ted