Replace strSQL Message Updating

naminder

Registered User.
Local time
Today, 20:44
Joined
Aug 8, 2005
Messages
41
I want to replace the standard update record message with a custom one.

My Code

strSQL = "UPDATE tblBeds SET lngFKStatusNo = 2 WHERE autBedNo = " & Me.txtFKBedNo & ";"

DoCmd.RunSQL strSQL

You are about to update 1 row(s)

Want to replace this with a msgbox saying

"Are you sure you want to book this Bed?"
 
Use CurrentDB.Execute MySQL, dbFailOnError and you don't get any warnings and then you can put up any MsgBox you wish.
 
Great thank you, that worked! Can do custom messages now!

though i would post the code for others ;)

In the onclick event of button

Dim LResponse As Integer

LResponse = MsgBox("Do you wish to Confirm Bed?", vbYesNo, "Confirm Bed")

If LResponse = vbYes Then

DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
strSQL = "UPDATE tblBeds SET lngFKStatusNo = 2 WHERE autBedNo = " & Me.txtFKBedNo & ";"
CurrentDb.Execute strSQL, dbFailOnError
Me.Parent![sfrmClientBeds].Requery
Me.lstProvider.RowSource = ""
Me.lstBedNo.RowSource = ""

Else
'Do Nowt
End If
 
Great! Glad you got it working. Just for the record, the legacy command:
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
has been replaced with:
DoCmd.RunCommand acCmdSaveRecord
Converting DoMenuItem to RunCommand
 
ok noted! It's just that Access 2003 puts it in by default. I created a simple save button originally!
 
I know. M$ has not gotten around to updating the wizards yet. ;)
 

Users who are viewing this thread

Back
Top Bottom