Hi jav,
I realize you directed this to Allen but as I developed the following as a
result of his help I thought I should share it with you. Allen might even be
able to show both of us a better way.
I created a table with three fields. One for each value to be saved. (The
table needs to be created first or the Open event will error.) I then created
the following subs for the Form Open event and the Form close event.
While in the VBA Editor you will need to Select Tools -> References and then
check the box against Microsoft DAO 3.6 Object Library. (Ensure you check the
box and not just select the line before clicking OK.)
Private Sub Form_Open(Cancel As Integer)
Dim rsCurrent As DAO.Recordset
'Copy the last ComboBox settings back to the ComboBoxes
Set rsCurrent = CurrentDb.OpenRecordset _
("SELECT StartNumber,EndNumber,RecipContactFilter " & _
"FROM [View_Edit Receipt Default Filters]")
With rsCurrent
.MoveFirst
Me.StartNo = .Fields("StartNumber")
Me.EndNo = .Fields("EndNumber")
Me.RecipContactFind = .Fields("RecipContactFilter")
End With
rsCurrent.Close
Set rsCurrent = Nothing
Me.Requery
End Sub
Private Sub Form_Close()
'Save the ComboBox Settings to use as defaults at next form open.
Dim rsCurrent As DAO.Recordset
Set rsCurrent = CurrentDb.OpenRecordset _
("SELECT StartNumber,EndNumber,RecipContactFilter " & _
"FROM [View_Edit Receipt Default Filters]")
With rsCurrent
.MoveFirst
.Edit
.Fields("StartNumber") = Me.StartNo
.Fields("EndNumber") = Me.EndNo
.Fields("RecipContactFilter") = Me.RecipContactFind
.Update
End With
rsCurrent.Close
Set rsCurrent = Nothing
End Sub
Hope it helps. Feel free to get back to me if you have any problems with it.
--
Regards,
OssieMac
jav said:
Hi Allen,
I'm a newb and was wondering if you could you provide a little more detail
regarding how to actually execute those 3 steps? i.e. How do I actually
assign a defaultvalue using the afterupdate event, how to save the
defaultvalue into a table using the unload event, read value from table and
assign it to the combo's default value.