Is there an "isset" function in VBA?

Cowboy

Registered User.
Local time
Today, 03:01
Joined
Jul 23, 2010
Messages
53
I'm trying to use a TempVar to pass along a value from one form to another to hide or unhide a control based on the user's action on the previous form.

I want to put some error checking in for this, so I want to start my hide-unhide constraints with an If statement like:

If TempVar!myVar isset Then
...
Else
...
End If

Is there a way to do this?

Thanks.
 
Thanks for the response.

Is it, TempVar!varLocation or TempVars!varLocation?

I had TempVars!varLocation, which seems to work, but I don't know if it is correct syntactically.

Thanks for the help!
 
Probably TempVars with the s. I don't use them so I'm a little less familiar with them than a lot of stuff.
 
In the case where you use Set syntax, certain "cleanup" rules should be applied. If you apply, them, then there is a syntax that might help.

Setting a variable, let's say its a recordset...

Code:
    Set rsVar = CurrentDB.OpenRecordset(.... etc.)

To properly release this, you must do TWO things...

Code:
    rsVar.Close
    Set rsVar = Nothing

If you don't do the Set to "Nothing" then the implied structure is still there and could still be opened. Not wise to actually open it again, but then again, this IS a Bill Gates product.

Anyway, the test you seek for this case would be

Code:
    If rsVar Is Nothing then ....
 
Thanks for the tips!

I really should have paid better attention in DB classes in college...:o
 

Users who are viewing this thread

Back
Top Bottom