ACC: "Invalid Use of Null" with SysCmd() FunctionID: Q124160
|
Moderate: Requires basic macro, coding, and interoperability skills.
When you use the SysCmd() function in Access Basic code, you may receive
the error message "Invalid use of Null."
This error message occurs when the SysCmd() function returns a null value and the return variable is declared as any data type other than Variant.
Make sure that the return variable for each call to the SysCmd() function has a Variant data type.
This behavior no longer occurs in Microsoft Access version 7.0.
The only Access Basic data type that can hold a null value is the Variant
data type. Since the SysCmd() function frequently returns a null value, the
return variable should have the Variant data type, as in the following
example:
Dim ReturnVal As Variant
ReturnVal = SysCmd(4, "Status Bar Text Message")
Dim ReturnVal
ReturnVal = SysCmd(4, "Status Bar Text Message")
Option Explicit
Sub SysCmdDemo1 ()
Dim ReturnVal As Integer
ReturnVal = SysCmd(4, "SysCmd Fails")
End Sub
For more information about using the SysCmd() function in Microsoft Access version 2.0, search for "SysCmd," and then "SysCmd Function" using the Microsoft Access 2.0 Help menu.
Keywords : kberrmsg kbusage
Version : 1.1 2.0
Platform : WINDOWS
Issue type : kbprb
Last Reviewed: April 7, 1999