Thanks for your suggestions but I ended up simply using the following function:
Function formIsOpen(formVar As Form) As Boolean
On Error GoTo Exit_formIsOpen
Dim tempStr As String
formIsOpen = False
tempStr = formVar.Name
formIsOpen = True
Exit_formIsOpen:
Exit Function...
How can I check that a form is open using the variable:
public formVariable as Form
After formVariable is assigned, I realise I could use:
isLoaded(formVariable.Name)
but this would only check if an instance of the form is loaded, ie it may be a different instance of the form referenced in...
if I declare the public variable in a standard module I get the error:
"compile error. invalid use of property"
if I declare the public variable in form1, I get the following error when the variable is updated:
"run-time error '91':
Object variable or With block variable not set"
I have a parent form that has a subform (subForm1) that opens a form (form1)
form1 then needs to reference subForm1
form1 is opened by multiple forms, so I can't hardcode the reference to subform1 in form1
I want to declare a public variable (callingFormVariable) in form1 (or as a global)...
ok, I have two forms: Form1 and Form2
I want to set a puiblic variable (str1) in Form1 from Form2. Works fine if I use the following:
Forms!Form1.str1 = "blah"
BUT, I need to do this dynamically where the form name is in a variable. For this I need the eval function right? But this does...
How do I initialize a connection to my Access Database in VB?
eg, how would I initialize cnMyDB to use in:
cnMyDB.Execute("Select Value from Table where key=2")
Cheers
I want to run an SQL query to get a value from a table and store the result in a variable for further use.
How do I do this?
eg "select field1 from table1 where key = 121" may return one record: "fred" which I wish to store in a variable
I have found the following code in...
not quite what I'm after, I actually want to store in the variable a field value returned from the SQL query
ie, query may return "fred" which I want to store for later use
I have since found the following code in another thread, but I'm still a little confused:
Set rsMyValue =...
I want to run an SQL query to get a value from a table and store the result in a variable for further use.
How do I do this?
eg "select field1 from table1 where key = 121"
Cheers
ah yes, I wasn't including the form name when referencing the variable
is there any other way to reference a global variable without specifying a specific form? (since that is defeating the purpose of using the public variable in the first place)
thanks again
I'm simply trying to set a global variable which is set by one form and accessed by another, but it is not working.
I have declared it as public in the first module, but don't seem to be able to access it in another module.
Any idea what I may be doing wrong?
I have tried declaring it as...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.