Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

asking to save changes

Status
Not open for further replies.

Nialler

Programmer
Feb 25, 2002
11
IE
I am currently building a form and I have used the controlsource on the properties of the textboxes to link them to a table. My problem is now I want to put in a msgbox in the “afterupdate” to confirm if a person wants to save a change or not.

If MsgBox("Save these changes?", vbYesNo) = vbYes Then
.Update
Else
.CancelUpdate
End If

Obviously the .update doesn’t work becaues I have no record set in the code

Is there away of doing this I tried coding it below

I also tried to code in a database and recordset but I can’t link the textboxes to the table
Dim dbs As Database, rst As Recordset
Set dbs = CurrentDb
Set rst = dbs.OpenRecordset("tblDetails")

I tried coding in the control source but still no success.
Forms!frmEntry.RecordSource = "tblDetails"
Me!txtProductLine.ControlSource = rst![ProductLine]
I also put code into the buttons e.g.

Private Sub bttPrev_Click()
On Error GoTo Err_bttPrev_Click

rst.MovePrevious

Exit_bttPrev_Click:
Exit Sub

Err_bttPrev_Click:
MsgBox Err.Description
Resume Exit_bttPrev_Click

End Sub
But this gives me errors too

I’m sure this code worked for me years ago but I can’t remember how to do it. I would be very grateful if someone could refresh my memory before I go insane
 
In place of the .Update, I think you can just put this line in to save the stuff:

DoCmd.DoMenuItem acFormBar, acRecordsMenu, SaveRecord, , acMenuVer70


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top