Anthony Farinholt
asked on
Access2017 parameter goes NULL
Using docmd.openform( argument ), with a non-null argument...when single step debugger to the open form it shows the argument as null. Anyone seen things like this? If so, please help!
Make sure that your form name is in quotations -- otherwise it may appear like an undeclared variable (null):
Alternatively, declare and set a string variable for your form name, and then use the variable name without quotes:
And as a good practice you should always use Option Explicit at the top of your code modules, right under option Compare Database. This forces you to declare all of your variables... which may help in debugging issues like this:
' Use quotes around the first argument (form name)
' Example 1
docmd.openform( "argument" )
' Example 2
docmd.openform( "MyFormName" )
Alternatively, declare and set a string variable for your form name, and then use the variable name without quotes:
' Example 3
Dim strFormName as string
strFormName = "MyFormName"
docmd.openform( strFormName )
And as a good practice you should always use Option Explicit at the top of your code modules, right under option Compare Database. This forces you to declare all of your variables... which may help in debugging issues like this:
Option Compare Database
Option Explicit
Give an example of DoCmd.OpenForm
And what are you testing in the OpenForm event?
And what are you testing in the OpenForm event?
This question needs an answer!
Become an EE member today
7 DAY FREE TRIALMembers can start a 7-Day Free trial then enjoy unlimited access to the platform.
View membership options
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
What is it your trying to pass? Unless you use named arguments, you need to supply all the parameters, and openargs is last.
Jim.