Change a form's name programatically

  • Thread starter Thread starter Alex
  • Start date Start date
A

Alex

Hi anyone,
Here is my question:

I have a function that returns some result.
As a passing-in variable there is a string containing the
name of a form:

function A (strNameForm as String) as boolean.

if Forms!"strNameForm".RecordsetClone.RecordsCount then...
a = true
end if

What is the proper way to put strNameForm in this
expression?
The ways I tried it always gives me an error...:(

Thanks for your advise, Wizards. Respect
 
Alex said:
I have a function that returns some result.
As a passing-in variable there is a string containing the
name of a form:

function A (strNameForm as String) as boolean.

if Forms!"strNameForm".RecordsetClone.RecordsCount then...
a = true
end if


You can do it this way:

Function A (strNameForm as String) as boolean.
A = Forms("strNameForm").RecordsetClone.RecordsCount > 0
End Sub

Make sure that
 
Actually, that should be

A = Forms(strNameForm).RecordsetClone.RecordsCount > 0


The way Marshall had it, it would be looking for a form named strNameForm,
not a form named the same as the contents of the variable strNameForm.
 
Douglas said:
Actually, that should be

A = Forms(strNameForm).RecordsetClone.RecordsCount > 0


The way Marshall had it, it would be looking for a form named strNameForm,
not a form named the same as the contents of the variable strNameForm.



That message got sent by an inadvertant fat finger keyboard
event and I had to leave before I could find and fix it.

Thanks for straigtening it out Doug.
 
Back
Top