Combo Box default value...

  • Thread starter Thread starter Kent
  • Start date Start date
K

Kent

Is there a way to make the default value of a combobox (on
a data entry form) be whatever it was in the last record
entered?

Thanks!
Kent.
 
Kent,

Try putting this code on the After Update event of the combobox...
Me.NameOfYourCombobox.DefaultValue = Me.NameOfYourCombobox
 
Steve,

Thanks for taking the time to help me. I tried your
suggestion, and I think I must be doing something wrong
still. When I "Add a New Record" in the form, it still
comes up blank in the combo box, and, when I try to select
an existing value from the list I get the error message:

"Microsoft Access can't find the macro Me."

and then complains that the macro either doesn't exist or
hasn't been saved etc...

Any further thoughts would be appreciated.

Thanks again,
Kent.
 
Kent,

It sounds like you might have typed the code I gave you directly into
the property sheet? You need to do this way instead... Enter [Event
Procedure] in the After Update event property, and then click the little
button on the right with the (...) to open the Visual Basic Editor
window. Type the code between the lines that will altready be there by
default:
Private Sub NameOfYourCombobox_AfterUpdate()
Me.NameOfYourCombobox.DefaultValue = Me.NameOfYourCombobox
End Sub
 
Thank you so much, Steve. This worked!

I'm sorry to be such a rookie. It has been a while since
I've had to create a relational database and this is my
first experience with Access.

Thanks again!!
Kent.
-----Original Message-----
Kent,

It sounds like you might have typed the code I gave you directly into
the property sheet? You need to do this way instead... Enter [Event
Procedure] in the After Update event property, and then click the little
button on the right with the (...) to open the Visual Basic Editor
window. Type the code between the lines that will altready be there by
default:
Private Sub NameOfYourCombobox_AfterUpdate()
Me.NameOfYourCombobox.DefaultValue = Me.NameOfYourCombobox
End Sub

--
Steve Schapel, Microsoft Access MVP
Steve,

Thanks for taking the time to help me. I tried your
suggestion, and I think I must be doing something wrong
still. When I "Add a New Record" in the form, it still
comes up blank in the combo box, and, when I try to select
an existing value from the list I get the error message:

"Microsoft Access can't find the macro Me."

and then complains that the macro either doesn't exist or
hasn't been saved etc...

Any further thoughts would be appreciated.

Thanks again,
Kent.
.
 
Back
Top