String substitution? (1 Viewer)

dudezzz

Registered User.
Local time
Today, 09:15
Joined
Feb 17, 2005
Messages
66
I need to call a procedure called "Enableall" from my VBA code in the form. This function is defined as follows:

Sub enableall(bolenable as boolean, frm as Form)

When I call this using the following method it works fine:

enableall false, me

However, if I need to substitute a variable, say, var=forms!myform and then I call this function the following way it doesnt work:

enableall false, var


What is the correct syntax to call this procedure? I run into this string substitution problem all the time....Is there an easy way to remember how number / string variable substitution works in Access?

Thanks.
 

MarkK

bit cruncher
Local time
Today, 07:15
Joined
Mar 17, 2004
Messages
8,186
This is not a 'string substitution' problem, but rather, a data type problem. I assume your variable 'var' is a Variant type, but your function declaration is expecting a Form type.

Dim frm as Form
Set frm = Forms!yourForm
enableall(false, frm)
 

Users who are viewing this thread

Top Bottom