get a reference on a form by using form's name

G

Guest

I'm trying to use a form name as a parameter to use it when this form is
opened to recalculate it from another (modal) form. I have just the one modul
form. But, to be recalculated forms can be different. This is why I'd like to
get a reference to know which one is opened.
Dim strFormName As String
Private Sub Form_Load()

strFormName = Trim(Me.Name)

fnFormName(strFormName)

End Sub

But, how is it possibleto get the reference on that to be recalculated form?
In the modal form something like the following:
[Forms]![& strFormName &].Recalc - unfortunately, it's not working

Thanks
 
G

Guest

Thanks, Mr. B.

But, it says "Microsoft Office Access can't find field ... (which is the
form name) reffered to your expression". So, it thinks it a field not a form
name.


Mr B said:
Try:

Form(strFormName).Requery

hth

Mr. B

Alex said:
I'm trying to use a form name as a parameter to use it when this form is
opened to recalculate it from another (modal) form. I have just the one modul
form. But, to be recalculated forms can be different. This is why I'd like to
get a reference to know which one is opened.
Dim strFormName As String
Private Sub Form_Load()

strFormName = Trim(Me.Name)

fnFormName(strFormName)

End Sub

But, how is it possibleto get the reference on that to be recalculated form?
In the modal form something like the following:
[Forms]![& strFormName &].Recalc - unfortunately, it's not working

Thanks
 
J

John Vinson

Thanks, Mr. B.

But, it says "Microsoft Office Access can't find field ... (which is the
form name) reffered to your expression". So, it thinks it a field not a form
name.

I think Mr. B. meant to say Forms(strFormName) - not Form().

John W. Vinson[MVP]
 
G

Guest

Thanks, John,

Yes, that is exactly what I meant to say.

Sorry, Alex, I'll try to be more careful with my typing.

Mr. B
 
A

Albert D. Kallal

Any reason why you don't use

me


"me" is always the current forms ref

so

me.requery
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top