I have a subroutine that I have ON OPEN for a few of my forms. I would like to take that subroutine and make it so that for all of my forms that open to do this subroutine. How do I go about doing this??
in a module enter the following code
be careful with all the single and double quotes
and on the properties tab of the form enter =logform()
Public Function logform()
With DoCmd
.SetWarnings False
.RunSQL "INSERT INTO LOG_REPORT ([DATE],[USER],HOST,TASK)SELECT Now(),'" & Environ("username") & "','" & Environ("COMPUTERNAME") & "','" & ActiveForm.Name & "'"
.SetWarnings True
End With
End Function
a bit of change is required
change this line to
Public Function logform()->Public Function logform(fromname)
.RunSQL "INSERT ........,'" & ActiveForm.Name & "'"-->
.RunSQL "INSERT ........,'" & fromname & "'"-->
and =logform() --> =logform("the name of the form")
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.