From Main Form, Click Open Switchboard Macro - Stop Saving Default Data as a record!

RogueJD

Access Beginner
Local time
Today, 10:49
Joined
Jan 13, 2010
Messages
30
Hey all.

Access initiate here.

I have a command button that runs a macro in the Header of a Main Form:

OpenForm Switchboard, Form, , , , Normal
Close Form, MainForm, Prompt
StopMacro

It does what I want it to do - a button that closes the Main Form, and opens the Switchboard. The problem is the Main Form has default values. Whenever that button in the header is clicked, it saves the default values as a new record with no prompt.

Essentially, I want to click the "Open Switchboard" button, then have a prompt notifying me that there is unsaved data on the Form (which would be either default data, or a record that I was working on). I'd like to option to Save the record and continue, Don't Save the record and continue, or Cancel opening the Switchboard Form.

How's this accomplished?

Thanks!
 
try this code...or similar

Code:
a = MsgBox("To save or not to save", vbYesNo, "SPENTY")
 
    
    If a = 7 Then 'clicked no
        DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
        DoCmd.DoMenuItem acFormBar, acEditMenu, 6, , acMenuVer70
    Else
        DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
    End If
    
    DoCmd.Close
    stDocName = "Switchboard"
    DoCmd.OpenForm stDocName, , , stLinkCriteria
 

Users who are viewing this thread

Back
Top Bottom