Storing Variables in a form search

Arshan

New member
Local time
Today, 07:07
Joined
Jul 21, 2009
Messages
5
I made a database with a form that is a search enginge. When they enter the primary key the query brings up all the information. THe problem is anyone can change it from here. What I want to do is, when someone does a search is store all the information it comes up with in variables, and make a cancel button so if things are changed, the cancel button will bring back the default items that were made. Is there any way to do this?


Thanks
 
Just set the Allow Edits property to False. This way, the cant edit the record.
 
The easiest way I have found to do this is to place a cancel button that closes the form and and in the forms before update event check to see if this cancel button has focus. If it has then cancel the event and close the form. So if a user makes changes, then clicks the cancel button, it cancels the update event and closes the form...
 
There's no need to store the data in variables, simply offer the user the chance to save or dump the edited data in the Form_BeforeUpdate event:

Code:
Private Sub Form_BeforeUpdate(Cancel As Integer)
If Not (Me.NewRecord) Then
 If MsgBox("Would You Like To Save The Changes To This Record?", vbQuestion + vbYesNo + vbDefaultButton1, "Save Changes to Record ???") = vbNo Then
  Me.Undo
 End If
End If
End Sub
 
Hum... I like the undo thing. But having to confirm every save...maybe not. How about do the undo with a cancel button?
 
That worked. Thanks a lot. Expect to see me around here more often which such fast responces :p
 

Users who are viewing this thread

Back
Top Bottom