Insert Text In Combo Box

adam.greer

Registered User.
Local time
Today, 13:59
Joined
Apr 27, 2006
Messages
43
Hi guys

I need a button to launch a new form with a piece of text inserted into a combo boxed. The text will be from a combo box on the original form.

I tried setting the default value of the new box based on the old one but that didn't work, so I am trying to find a piece of code.

Anyone give me a hand here?



Adam
 
On the "new form", in the On Open event, you could say

Me.FieldName = forms!OldForm.OldFieldName
 
The DoCmd.OpenForm method accepts an OpenArgs parameter. This is a value that you can set when you run the DoCmd.OpenForm that will be passed to the opening form. Then in the form's load event you can take this value and populate your combo box.

Initial Form Click Event:
Code:
DoCmd.OpenForm "YourFormName", acNormal, OpenArgs:=cboFirstCombo.Value

New Form:
Code:
Private Sub Form_Load()
    cboNew.Value = OpenArgs
End Sub
 
Thanks guys worked a treat.

Sorry for the delay in replying, had some time off work for shopping (bloody christmas)

Thanks again
 

Users who are viewing this thread

Back
Top Bottom