Passing a form as a parameter

  • Thread starter Thread starter Albert D.Kallal
  • Start date Start date
A

Albert D.Kallal

Hum, what you have looks ok.

Of course, most form code can use "me", which represents the current form.

So, you code could be:

Call ProcessStuff(me)

Sub ProcessStuff(frmPassed as Form)

Dim x as string

x = frmPassed!txtXYZ

End Sub

Hum, assuming that txtXYZ is on the form, then the above should work....
 
I want to pass an active form to a subroutine, and have some action
taken on some fields on the form, but am unsure about the syntax. Let's
say I have a form, 'frmABC'. On the form is a field, txtXYZ. I want to
pass the form to a subroutine named ProcessStuff. Would I use:

Call ProcessStuff([Forms]![frmABC])

------------------------------------

Sub ProcessStuff(frmPassed as Form)

Dim x as string

x = frmPassed!txtXYZ

End Sub
 
Phil,

Try this:
x = frmPassed.txtXYZ

(a dot instead of a bang)

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia
 
Back
Top