auto save problem

rashidzaib

Registered User.
Local time
Today, 03:58
Joined
Aug 12, 2007
Messages
32
hy bro and sis
i hope all r fine
i have one problem in access and that is when i am entering the new data it is save automatically. i want to save data when i press save button otherwise it will not save data and also for update i also want updation through command button is there any solutiion for this.
any help should realy be appriciated.
thank u
ur truly
rashid zaib
 
This will cover both situations. You don't really need a command button to save the record. If a new record is entered, it will ask if the new record should be saved when you try to go to another record or close the form. If an existing record is updated, it will ask if the changes should be saved when you try to go to another record or close the form.

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
Else
 If MsgBox("Would You Like To Save This Record?", vbQuestion + vbYesNo + vbDefaultButton1, "Save This Record ???") = vbNo Then
  Me.Undo
 End If
End If
End Sub
Linq
 
Last edited:
For auto save problem

i think u can solve this problem if remove the recordsource of the form and also making the fields unbound.
And then on Save command button open a recordset to the table and save the record.
but have to write some code.
may this help u
bye.
 
You're exactly right, Pat! Why in the world would anyone want to get involved in the gigantic hairball that unbound forms are, rather than simply copying and pasting a dozen lines of code, simply to be able to check to see if the user wants to save a record/change or dump it?

Linq
 
Last edited:
auto save problem solved

hy bro
sorry yesterday i did not used internet. and thank u very much for help me and giving me very nice information .
this code i have tried and working very nicely
thank u very much
 
i only suggest the way...
So, why u people r so anguish

I think they were just trying to say that your way had unnecessary complications and there was a simpler way of doing things. The best solution is the simplest one that meets all requirements.
 
Glad it works for you, rashidzaib!

Ahmed: no one was angry, but you simply don't need a Cruise Missile to kill a fly! Changing a bound form to an unbound form would mean a huge amount of work! Why do that when 12 lines of code will accomplish the task and not require a complete rework of the form?

Linq ;0)>
 

Users who are viewing this thread

Back
Top Bottom