openargs

B

Bill H.

I've set a value to stLlinkCriteria in the main form, and using a command
button to open another form via docmd.openform as below:

DoCmd.OpenForm stDocName, , , stLinkCriteria

I want to test, so on the stDocName form, I have as an On Open event, a
simple 'msgbox openargs' statement, and I always get an "invalid use of
Null" error msg.

Why?
 
D

Duane Hookom

OpenArgs is the seventh argument in OpenForm.
OpenForm FormName, View, FilterName, WhereCondition, DataMode, WindowMode,
OpenArgs

What value do you expect to return from the OpenArgs when you aren't sending
anything?
 
D

Douglas J. Steele

As Duane points out, you're not passing anything as the OpenArgs parameter,
so it doesn't really make sense to check...

However, OpenArgs will always be Null if nothing was passed, so you need to
check:

If IsNull(OpenArgs) Then
MsgBox "Nothing was passed"
Else
MsgBox OpenArgs & " was passed as OpenArgs"
End If
 
Top