passing a form object into a function.

  • Thread starter Thread starter Grant
  • Start date Start date
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.
 
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])
 
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).
 
Back
Top