Passing a reference to a textbox to a function

C

cy.johnson

I wrote a generic module so I could reuse it.
I pass a textbox to the function, and later on the function updates
the value in the textbox that is passed into it.

What I can't understand is that Me.txtPressIdLink is Null in
Form_Current(). I am trying to pass a reference to the text box, not
the Me.txtPressIdLink.value. I guess it uses the default (which is
the value), but I want it to pass a reference to the txtPressIdLink
control.

Thanks.

FORM CODE:

Private Sub Form_Current()

'Init the Press Navigation variables
Call init_PressNavigation(Me!pkJobID, Me.txtPressIdLink)

end sub

MODULE CODE:

Public Function init_PressNavigation(in_lngJobID As Long, txtbox As
TextBox)
...
' Do some stuff.
...

' Update the value in the input text box.
Call update_PressNav_txtPressIdLink(txtbox)

End Function


Public Function update_PressNav_txtPressIdLink(txtbox As TextBox)
txtbox.Value = "Whatever"
End Function
 

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