Populate value when a form is opened

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Gurus,

I have a combo box in a form. When the form is opened I want to display the
value which is in the combo box. At any given time there will be only one
value.

How would I go about it. Appreciate any help.

Thanks a million.
 
It may be just me that doesn't understand that, but exactly what do you
mean? If the value is in the combo box then it is being displayed. Or do
you mean display it in a different way?
 
Sorry if I was not very clear. Unless I go and select the value from the
combo drop down the value would come up. What I need is as soon as I open
the form I want that to be displayed.

I have already tried Me.ComboName = Value. This is not working.
 
Still makes no sense. What is "that"?

PS said:
Sorry if I was not very clear. Unless I go and select the value from the
combo drop down the value would come up. What I need is as soon as I open
the form I want that to be displayed.

I have already tried Me.ComboName = Value. This is not working.
 
I do not know which part you dont understand. OK. Let me be more specific.

The row source for the combo in "formA" is a query that returns a single
value. The control source is the table field. I open "formA" from another
(formB) and go to a new record (DoCmd.GoToRecord , , acNewRec), which works
fine. When the "formA" is opened the combo box is empty (like other fields).
I do not want it to be empty because I dont want the user to select it from
the drop down. Rather I want to somehow populate the value as soon as the
"fromA" is opened.

Hope it now makes sense.
 
Before you move to the new record, you can set the default of the combo

Me.ComboName.DefaultValue = Value
DoCmd.GoToRecord , , acNewRec
--
If I answered your question, please mark it as an answer. That way, it will
stay saved for a longer time, so other can benifit from it.

Good luck
 
Back
Top