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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Docmd.close,,acSavePrompt

Status
Not open for further replies.

shyamsundar

Programmer
Aug 23, 2002
75
IN
Hi Tech Guys

DoCmd.Close , , acSavePrompt is not prompting onclick even, am i doing anything wrong.

Pl. Help Shyam
cwizshyam@yahoo.com
 
Shyam,

Sometimes people get confused with this command. The save you would be prompted for is a change in the design, not a change in the record. If you're looking to save the record, you can use:
call docmd.RunCommand(acCmdSaveRecord)

There's no built in prompt, so you'd want to wrap it in an if structure, maybe like this:

If vbYes = MsgBox("Do you want to save the record?", _
vbQuestion + vbYesNo, "Save Record?") Then
Call DoCmd.RunCommand(acCmdSaveRecord)
End If

Hope this helps.

Jeremy =============
Jeremy Wallace
AlphaBet City Dataworks

Take a look at the Developers' section of the site for some helpful fundamentals.
 
Or you might only want to ask the question if the record has been changed (is "dirty"), so if you have a command button you're clicking to close the form you might want something like:

Code:
If Me.Dirty Then
    If MsgBox("Do you want to save changes to this record?", vbYesNo + vbQuestion, "Save") = vbYes Then
        Call DoCmd.RunCommand(acCmdSaveRecord)
    End If
End If
[pc2]
 
Jeremy & mp9,

Great, it works thanx very much for the time.


Shyam Shyam
cwizshyam@yahoo.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top