Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Setting the default value of a Combo Box.
02-02-2010, 06:02 PM
Post: #1
Setting the default value of a Combo Box.
Can anyone please help me with the following problem?

I wish to set the default value of a Combo Box on a form, whose source is a table. An example is Order Status code that can have the values Outstanding; In Progress; Completed etc. On a new order I wish the Order Status to have a default value : “Outstanding”

Whilst I realise this can be achieved by setting the default value to the record key of the table that holds the values, doing it this way means that to change the default value, a user of the application would need to have the opportunity of amending the table properties, which I do not wish to allow. I would prefer that the user have the option to determine the default Order Status by the use of a flag or parameter held on the appropriate record by use of a table maintenance form. i.e. set a flag to a value of ”D” to the appropriate record.
Find all posts by this user
Quote this message in a reply
02-03-2010, 06:13 PM
Post: #2
RE: Setting the default value of a Combo Box.
Look on the Data tab of your Combo box's properties. You will find a field that reads "Default Value"
Find all posts by this user
Quote this message in a reply
02-03-2010, 07:11 PM
Post: #3
RE: Setting the default value of a Combo Box.
roop12345

When you set the defautl value for any field, or any control, that "default" value is only applied to a new record. Users can then make changes to that default value at any appropriate time, based on the existance of other restrictions that may or may not be applied. In your case, you can simple enter the default value of "Outstanding" in the Default Value property of your Combo box and that default value will be applied to each new record. Your users can then select the other options as the situation demands.

If there are other criteria that determine when a record status needs to have one of the other values applied, you can even change the value of the combo box using additional VBA code as appropriate when that other criteria is met.
Find all posts by this user
Quote this message in a reply
02-04-2010, 06:22 PM
Post: #4
RE: Setting the default value of a Combo Box.
Thanks for the replies. However, this approach does not work here. The data held in the form control source is the numeric key (AutoNumber) to the records held on the table of possible values. Therefore I can set the default to the appropriate key i.e. 27 and the user is presented with the value of "Outstanding", (the second field of the query behind the Combo Box, the key being the first). Although this gives me exactly what I want, I am trying to avoid using the look up table key in the default property. I was trying to achieve this by adding a third field to the look up table which could have the value, say, "Default" against the chosen record in the list of options. This would allow the user to control the default value to be applied via a maintenance process/form, should system circumstances change. I have about 30 data elements which are controlled by combo boxes and it would be a real advantage for the user to be able set the default value of many of these fields, without me having to change the underlying code/properties each time.
Find all posts by this user
Quote this message in a reply
02-04-2010, 06:42 PM
Post: #5
RE: Setting the default value of a Combo Box.
I still don't fully understand what you're after. Does the combo box change value everytime a new record is added?
Find all posts by this user
Quote this message in a reply
Post Reply 


Forum Jump:

Contact UsDeveloper SolutionReturn to TopReturn to ContentLite (Archive) ModeRSS Syndication