Set combo box default to previous value

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

Guest

I have a form with six combo boxes that are used to select "Nip ID" values
from a table. The application is a machine process set-up and I want to track
the number of hours that have accumulated on rubber Nips so they can be
changed before they fail.
I would like to have the combo boxes default to the value in the previous
record. I found a posting with some code which is suppose to do this but I
can't get it to work. My skill level is Access Beginner, so please be
specific.
The following is the code I'm trying to use:

Private Sub Nip_9_AfterUpdate()
Me.Nip_9.DefaultValue = Chr(34) & Me.Nip_9 & Chr(34)
End Sub
 
Hmmm...I would just use

Private Sub Nip_9_AfterUpdate()
Me.Nip_9.DefaultValue = Me.Nip_9.Value
End Sub
 
Well, I'm closer. The suggested code does update the default value listed in
the Nip_9 combo box Properties to the value from the previous record.
However, when I add a new record through my form, the Nip_9 box opens with
#Name? in it which then goes blank as soon as I start to input information
into other fields in the form.

I'm not sure what is going on here, but I am thinking that maybe instead of
changing the default value I might need to change the default row for the
table that the combo box uses for the drop down list. Any additional
thoughts? Thanks again for your help.
 
Back
Top