Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Trouble setting default value

Status
Not open for further replies.

jen1701

Programmer
Dec 20, 2003
57
US
I have a combo box which uses a value list. I want to set one of the value as default value. I set the value "Final" under the combo box Default Value property. But when I run the form, there is no default. Is there anything else I have to set in order to see the default value? I remember I set the default value the same way on another form, it worked. Can anyone give me some idea why this one is not working?? Thank you very much in advance.

Jen
 
How are ya jen1701 . . . .

I agree . . . . it should work.

Make sure your semicolons & quotation marks in the [blue]Record Source[/blue] are correct. If they are, delete the combobox and make another. In my experience, Value List in comboboxes don't always work first time out (from setting default to other operations)!

If this doesn't cure the problem, you may have to consider Compact & Repair or Reinstall . . .

cal.gif
See Ya! . . . . . .
 
Hi TheAceMan1,

Thank you for your reply. I tried your suggestions. Unfortunately, they did not work on my situation. Well, I used an entering event to set the value. It is a strange problem which I can not set the default value.
Anyway, thank you again for spending the time thinking about my problem. Talk to ya again.

Jen
 
These are the things that ruin a good day. Didn't Microsoft issue a bulletin about releasing a defective batch of combo boxes. Just kidding.

You might want to try setting the default programmatically on an appropriate event.

If Me.YourCombo.value = "" or IsNull(Me.YourCombo)
Me.YourCombo.Default = "final"
End If

Cheers,
Bill
 
OK jen1701 . . . .

I found just what you described in my library of problems. In a nut shell:
[blue]Assigning [purple]Default Value[/purple] for [purple]Value List[/purple], works in design view. [purple]It does not work in VBA![/purple][/blue]
As a good equivalent work around, instead of assigning a Default Value, assign the the value to the [blue]TextBox Portion[/blue] of the combobox. Like so:

Code:
[blue]Me!YourComboboxName.Text="[purple]ValueInCombobox[/purple]"[/blue]
When this is done, if you dropdown the list, you'll see its selected and you'd never know the difference. Also, a good place to put the code is in the [blue]Current Event[/blue] of the form. This way, any time you change records the default is set.

cal.gif
See Ya! . . . . . .
 
Hi Bill,

Thank you for your reply. I did try setting the default programmatically on an event. e.g. Me.ProcessLocation.DefaultValue = "Final"
It did not work. But it worked when the codes are: Me.ProcessLocation = "Final"
It is a very simple thing but It has cost me so much time. Since you all mentioned it is a known problem on setting default value. I can understand now. Thank you again for spending time to give me suggestion.

Jen
 
Hi TheAceMan1,

Thanks again to spend time and try to help me out. I am very precaiated. I will try your suggestion.

Jen
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top