whats wrong with my Isloaded statement

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a number of forms which should send a value back to a master form if
its open and have put this part of the code into a function. The function is
accessed properly and works till I get to the lines below where it always
evaluates the form 'MoneyForm' to false even though its open.

the form is called moneyform and is in the same project.

If CurrentProject.AllForms(MoneyForm).IsLoaded = True Then
atrTarget = Charge
Exit Function
Else
Exit Function
End If

I was having, almost random, problems with this in the individual form
modules and decided to put it into a function to simpify matters (except its
not working).

With much thanks in advance,

Amit
 
Hi,


Use the name, not the "symbol" of a name (a variable name):


AllForms("MoneyForm").IsLoaded


instead of

AllForms(MoneyForm).IsLoaded


which looks for the VARIABLE (or whatever is represented by the symbol)
MoneyForm.




Hoping it may help,
Vanderghast, Access MVP
 
Thanks guys thats certainly made the loop work properly (i knew it was
something to do with that form name but i couldnt put my finger on it), but
ive realised that the assignment inside the loop isnt working.

basically ive got this inside the loop:

<!--
If CurrentProject.AllForms("Moneyform").IsLoaded = True Then
strTarget = Charge
-->

where

<!--
strTarget = "Forms![MoneyForm]![" & strbox & "]"
-->

and should reference that control which is of the correct datatype.
and 'charge' is an currency datatype that holds a value from the form that
called this funciton.
when i use the debugger i can see that its evaluated strTarget correctly, as
in it says something like 'Forms![MoneyForm]![payment]' but im not sure its
evaluating it as a string or as a reference to a control or as a string which
it cant assign the currency value to.

again with thanks

Amit
 
Back
Top