passing a form object into a function.

G

Grant

How would I go about doing the following?

Public Function fRequeryData(CurrentForm As Form)
fCurrentForm.Undo
... and so on.

I am currently trying to call the function like this:
=fRequeryData(Form!frmRevSuppFc)


Thanks in advance for the replies,
Grant.
 
D

Dirk Goldgar

Grant said:
How would I go about doing the following?

Public Function fRequeryData(CurrentForm As Form)
fCurrentForm.Undo
.. and so on.

I am currently trying to call the function like this:
=fRequeryData(Form!frmRevSuppFc)


Thanks in advance for the replies,
Grant.

Where are you calling the function from? In principle, if frmRevSuppFc
is open, this should work:

=fRequeryData(Forms!frmRevSuppFc)


(note the 's' on the end of "Forms", which you didn't have). But if
you're calling the function from a control *on* frmRevSuppFc, then you
could take a shortcut and write:

=fRequeryData([Form])
 
J

John Vinson

How would I go about doing the following?

Public Function fRequeryData(CurrentForm As Form)
fCurrentForm.Undo
.. and so on.

I am currently trying to call the function like this:
=fRequeryData(Form!frmRevSuppFc)

If you're calling it in an Event procedure on the form, just use

=fRequeryData(Form)

On the other hand, if you're calling it from VBA code within the
form's module, use

xyz = fRequeryData(Me)

On the third hand, if you're calling it from a generic Module, use

=fRequeryData(Forms!frmRevSuppFc)

(assuming that frmRevSuppFc can be trusted to be open).
 

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