How do I set the default in a combo box to be the previous record?

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

Guest

I have several combo boxes in a form that I want to set the default as the
previous record to prevent the operators from having to re-select the unit
data each time they start a new unit. For example, I have a combo box called
SKU Number which calls on a database called SKU Categories for the pull down
selections on the combo box. The SKU Numbers are then stored in the database
Reject Causes. How would I go about setting the default for the SKU Number
combo box so that the last number selected shows up on the next record? I do
not know VBA and have just started using Access so any help would be greatly
appreciated.
 
I have several combo boxes in a form that I want to set the default as the
previous record to prevent the operators from having to re-select the unit
data each time they start a new unit. For example, I have a combo box called
SKU Number which calls on a database called SKU Categories for the pull down
selections on the combo box. The SKU Numbers are then stored in the database
Reject Causes. How would I go about setting the default for the SKU Number
combo box so that the last number selected shows up on the next record? I do
not know VBA and have just started using Access so any help would be greatly
appreciated.

It only takes one line of VBA code. Select the combo box; view its
Properties; select the Events tab, and click the ... icon by the
"After Update" event. Select the Code Builder. Access will give you
the Sub and End Sub lines; just add one more:

Private Sub SKU_Number_AfterUpdate()
Me![SKU Number].DefaultValue = """" & Me![SKU Number] & """"
End Sub

The """" is needed to insert a " mark before and after the current
value in the combo.

John W. Vinson[MVP]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top