hi
you can tacle this from 2 different sides:
either have
1. the form's controls (and the form itself) be unbound to anything, then
only when the SAVE button is clicked use code to save the details to a table
Private Sub cmdSave_Click()
Dim rs As New ADODB.Recordset
rs.Open "SavedSearches", CurrentProject.Connection, adOpenDynamic,
adLockOptimistic
rs!Field1 = TextBox1
rs!Field2 = ComboBox2
rs!Field3 = CheckBox3
rs!Field4 = SomethingElse
rs.Update
rs.Close
Set rs = Nothing
End Sub
2. have the form and all it's controls be bound to the SavedSearches table,
then add a variable in the form's code window
Private SaveClicked as Boolean
then use
Private Sub cmdSave_Click()
SaveClicked=True
End Sub
and then, use the Form_Unload event to check the condition of SaveClicked. if
it's true, just let access save the record automatically, otherwise, undo the
changes
Private Sub Form_Unload(Cancel As Integer)
If SaveClicked=False Then Me.Undo
End Sub
i prefer solution 1, it's cleaner and safer
good luck
Cron wrote:
Quote:
>Hi I'm trying to make a form that makes it optional for the user to
>save the inputted data. If the user does not tap the save button
>before leaving the form, the data is silently discarded.
>
>This may seem like a strange request but it's a search form I'm
>working on and I'd like the option to save common searches, so I've
>set up a table to store saved searches.
>
>Thanks for any help!
>Ciarán
--
May all beings be happy.
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...ccess/200809/1