Passing An Argument To A New Form's Control

  • Thread starter nouveauricheinvestments
  • Start date
N

nouveauricheinvestments

I opened a form via a button and I want to pass an argument to a combo
box control on that form. When the new form opens, the control I want
to preset is blank instead of containing the value it should have.
This is the code I am trying to use:

Private Sub DocumentTicket_Click()
DoCmd.OpenForm "DocumentATicket"
Form_DocumentATicket.LoggedByCombo.Value = ThisUser

End Sub
 
A

Allen Browne

Use:
Forms("DocumentATicket")!LoggedByCombo = ThisUser

Your code doesn't show where ThisUser comes from.
 
K

Ken Snell \(MVP\)

Try this:

Private Sub DocumentTicket_Click()
DoCmd.OpenForm "DocumentATicket"
Forms!DocumentATicket!LoggedByCombo.Value = ThisUser
 
N

nouveauricheinvestments

Try this:

Private Sub DocumentTicket_Click()
DoCmd.OpenForm "DocumentATicket"
Forms!DocumentATicket!LoggedByCombo.Value = ThisUser

Perfect. Issues resolved. Thank you.
 

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