Save button ???

G

Guest

I have a form with a cmd button that pops up a sub form. On the subform are 3
buttons, yes, no & cancel. The cancel button was easy, but having issue on
the yes button and maybe the no button.

Here is the code on the "no" button
I'm assuming that I need to close the pop up subform first then close and
save the record from the main form.
Private Sub cmdNo_Click()
DoCmd.Close
DoCmd.Close acForm, "frmNewRecord", acSaveYes
End Sub

I have no idea where to begin on the "yes" button... I want it to save the
form but then start a new record....

Private Sub cmdYes_Click()
DoCmd.GoToRecord , acForm, "frmNewRecord", acNewRec
End Sub

Is this it?
 
G

Guest

You don't need a popup form, all you need is a message box.
Save buttons, in gerneral, are a waste. When you move to a new record, the
current record will be saved unless you take some action to cancel it;
however, here is how I would do it:

Dim intAnswer As Integer

intAnswer = MsgBox("Save This Record", vbQuestion + vbYesNoCancel)
Select Case intAnswer
Case vbYes
If Me.Dirty Then
Me.Dirty = False
End If
DoCmd.GoToRecord , acForm, "frmNewRecord", acNewRec
Case vbNo
Me.Undo
Docmd.Close
Case vbCancel
Me.Undo
End Select
 
G

Guest

THANKS!!



Klatuu said:
You don't need a popup form, all you need is a message box.
Save buttons, in gerneral, are a waste. When you move to a new record, the
current record will be saved unless you take some action to cancel it;
however, here is how I would do it:

Dim intAnswer As Integer

intAnswer = MsgBox("Save This Record", vbQuestion + vbYesNoCancel)
Select Case intAnswer
Case vbYes
If Me.Dirty Then
Me.Dirty = False
End If
DoCmd.GoToRecord , acForm, "frmNewRecord", acNewRec
Case vbNo
Me.Undo
Docmd.Close
Case vbCancel
Me.Undo
End Select
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top