Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

form open check on report

Status
Not open for further replies.

jdmack2000

Programmer
Jul 1, 2002
7
US
I have a form that allows the user to pick the type of report he or she wants. I want to make sure the user opens the report via the form and not simply opening the form. Is there a way that I could write some code to check that the form has been open first?

Thanks for your help
 
Place this function in a module:
[tt]
Function IsLoaded(ByVal strFormName As String) As Integer

IsLoaded = False
Dim frm As Form
For Each frm In Forms
If frm.Name = strFormName Then
IsLoaded = True
Exit For
End If
Next frm

End Function
[/tt]

Then use an if/then to check for the form in question in the on-open event of your report. IE:
[tt]
If IsLoaded("FormNameToCheckFor") = False Then
'Do Something When True
Else
'Do Something When False
End If
[/tt]

HTH Joe Miller
joe.miller@flotech.net
 
You can use the form to pass an argument (via the OpenArgs property) to the report when opened and check for a specific value or even if IsNull or not during the OnOpen event.

[tt]
If IsNull(Me.OpenArgs) = True Then
'Do Something When Null
Else
'Do Something When Not Null
End If
[/tt]

HTH Joe Miller
joe.miller@flotech.net
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top