UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> Set Value on Combo Box    
 
   
IbobNdave
post Mar 15 2005, 12:07 PM
Post #1

UtterAccess Addict
Posts: 238
From: Kansas City, MO



I have a combo box on a form that when I open the form I want to have that combo box displaying a value I send from the previous form.

For example:

BoxList has 4 values from a query (a, b, c, and d). When I open the for with BoxList it shows blank and then I can choose from the drop down.

The previous form can pass a value (a, b, c, or d). Using this value I want BoxList to display that row when I open the form. I still want to be able to choose another value from the drop down if the users wants to change it.

Note: The query behind the combo box uses 2 columns, an ID column and a Description column. I want to be able to pass the ID from the previous form.

Also note, the previous form may pass a null value as the ID if the user is setting the value for the first time.

I hope this makes sense.

Thanks,
Matthew..
Go to the top of the page
 
+
Mitchell
post Mar 15 2005, 12:13 PM
Post #2

UtterAccess VIP
Posts: 3,275
From: England



You can utilise the OpenArgs method of the DoCmd.OpenForm command to pass the ID value from one form to the other, then in the OnLoad event of the form, use code to determine if the OpenArgs variable contains a value, if it does, set the combo box to that value using something like:

ComboBox1 = Me.OpenArgs

or just don't do anything.

HTH
Go to the top of the page
 
+
accesshawaii
post Mar 15 2005, 12:36 PM
Post #3

UtterAccess VIP
Posts: 4,606
From: From Hawaii - Now in Wisconsin...Am I Nuts?



Try placing this code in the on open event of form the form with the combo box.

Me.cboPassValue.Value = Forms!Form2.Form.ID.Value

You would just reference the ID value on the form that you're opening it up from, so it would display that record in the combo box. All the other records would be in the combo box too. Hope this helps.
Go to the top of the page
 
+

Thank you for your support! Reply to this topicStart new topic

Jump To Forum:
 



RSS Go to Top  ·  Lo-Fi Version Time is now: 24th May 2013 - 11:15 PM