Way for Combobox to default to last value?

  • Thread starter DominicGreco via AccessMonster.com
  • Start date
D

DominicGreco via AccessMonster.com

I've been trying to find a way to get Access to default to the last entered
value for a combobox in a field.

Here's the scenario: User inputs data into multiple combo boxes on form,
saves record and moves to next "blank" record. When the new record shows up,
the default value on some of these combo boxes is what was entered on the
last record. It sounds like a "On Open" macro function. But I can't find the
switch to do so.

Any help?
 
S

scubadiver

For a database I developed in an old job I used the following code in the
double click event of a button to create a new record that had replicated
information.

Just change the field names.

Private Sub TempSt_DblClick(Cancel As Integer)

With Me.RecordsetClone
.AddNew
!EmployeeID = Me.EmployeeID
!WeekID = DateAdd("d", 7, Me.WeekID)
!Dept = Me.Dept
!Subdept = Me.Subdept
!Costcentre = Me.Costcentre
!Rate = Me.Rate
!Contracthrs = 0
!timehalfhrs = 0
!doublehrs = 0
.Update
End With

end sub
 
D

DominicGreco via AccessMonster.com

Thanks for the suggestion. I would probably just atach this code behind my
"Next Record" button. This way all the field values I want to save are saved
when I hit it.

I'm assuming that the line of code with the "!" extension are your user
variables. And that these correspond to field names whose value you wanted to
save. Correct?

I can see where this saves them. But how do you populate the list or text box
with the appropriate value? Or how do you recover the saved information?
 
Top