By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,660 Members | 1,961 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,660 IT Pros & Developers. It's quick & easy.

button events-save, close form and then open form

P: n/a
kev
Hi folks,

I have a form for registration (frmRegistration) whereby i have two
buttons. One is Save which saves record using the OnClick property. I
used wizard to create the save button. The other one is Next button
which i created to open another form "frmSummary" which displays back
the records submitted. (i used the wizard to open form and find
specific records to display. All these works superb until a review by
users where they want to incorporate both functions in one single
button. Meaning they want to save record, close this form
(frmRegistration and then open
"frmSummary" which displays the specific record.

I tried using macro to achieve this but somehow it is returning me an
error as it does not open specific record in frmSummary. Can anyone
please help me achieve this?

Thanks a lot.

Jan 31 '07 #1
Share this Question
Share on Google+
3 Replies


P: n/a
On 30 Jan 2007 19:29:20 -0800, "kev" <ke******@gmail.comwrote:

Can't you just copy the code from the Save button to the top of the
Next button?

-Tom.
>Hi folks,

I have a form for registration (frmRegistration) whereby i have two
buttons. One is Save which saves record using the OnClick property. I
used wizard to create the save button. The other one is Next button
which i created to open another form "frmSummary" which displays back
the records submitted. (i used the wizard to open form and find
specific records to display. All these works superb until a review by
users where they want to incorporate both functions in one single
button. Meaning they want to save record, close this form
(frmRegistration and then open
"frmSummary" which displays the specific record.

I tried using macro to achieve this but somehow it is returning me an
error as it does not open specific record in frmSummary. Can anyone
please help me achieve this?

Thanks a lot.
Jan 31 '07 #2

P: n/a
kev
Hi Tom,

I copied the code as what you said and it worked as wanted.
I tried doing the same for Close form but with no success.
Perhaps you can point out my mistake?

Private Sub next_button_Click()
On Error GoTo Err_next_button_Click

Dim stDocName As String
Dim stLinkCriteria As String

DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, ,
acMenuVer70
stDocName = "frmSummary"
DoCmd.OpenForm stDocName, , , "EquipmentID = '" & Forms!
frmRegistration!EquipmentID & "'"

Exit_next_button_Click:
Exit Sub

Err_next_button_Click:
MsgBox Err.Description
Resume Exit_next_button_Click

End Sub

This saves the record and then opens frmSummary.
what i need to do next is to close the frmRegistration but how?
i want it to close right after frmSummary is opened.
is it possible?
pls help..thanks

Thanks
On Jan 31, 12:18 pm, Tom van Stiphout <no.spam.tom7...@cox.netwrote:
On 30 Jan 2007 19:29:20 -0800, "kev" <kevi....@gmail.comwrote:

Can't you just copy the code from the Save button to the top of the
Next button?

-Tom.
Hi folks,
I have a form for registration (frmRegistration) whereby i have two
buttons. One is Save which saves record using the OnClick property. I
used wizard to create the save button. The other one is Next button
which i created to open another form "frmSummary" which displays back
the records submitted. (i used the wizard to open form and find
specific records to display. All these works superb until a review by
users where they want to incorporate both functions in one single
button. Meaning they want to save record, close this form
(frmRegistration and then open
"frmSummary" which displays the specific record.
I tried using macro to achieve this but somehow it is returning me an
error as it does not open specific record in frmSummary. Can anyone
please help me achieve this?
Thanks a lot.- Hide quoted text -

- Show quoted text -

Jan 31 '07 #3

P: n/a
On 30 Jan 2007 22:00:06 -0800, "kev" <ke******@gmail.comwrote:

After the DoCmd.OpenForm line write:
DoCm.Close acForm, "frmRegistration"

As you are getting more ambitious with your applications, you need to
start paying attention to what the wizard is writing for you, and
understanding it. That's the first step towards being able to write it
yourself.

-Tom.

>Hi Tom,

I copied the code as what you said and it worked as wanted.
I tried doing the same for Close form but with no success.
Perhaps you can point out my mistake?

Private Sub next_button_Click()
On Error GoTo Err_next_button_Click

Dim stDocName As String
Dim stLinkCriteria As String

DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, ,
acMenuVer70
stDocName = "frmSummary"
DoCmd.OpenForm stDocName, , , "EquipmentID = '" & Forms!
frmRegistration!EquipmentID & "'"

Exit_next_button_Click:
Exit Sub

Err_next_button_Click:
MsgBox Err.Description
Resume Exit_next_button_Click

End Sub

This saves the record and then opens frmSummary.
what i need to do next is to close the frmRegistration but how?
i want it to close right after frmSummary is opened.
is it possible?
pls help..thanks

Thanks
On Jan 31, 12:18 pm, Tom van Stiphout <no.spam.tom7...@cox.netwrote:
>On 30 Jan 2007 19:29:20 -0800, "kev" <kevi....@gmail.comwrote:

Can't you just copy the code from the Save button to the top of the
Next button?

-Tom.
>Hi folks,
>I have a form for registration (frmRegistration) whereby i have two
buttons. One is Save which saves record using the OnClick property. I
used wizard to create the save button. The other one is Next button
which i created to open another form "frmSummary" which displays back
the records submitted. (i used the wizard to open form and find
specific records to display. All these works superb until a review by
users where they want to incorporate both functions in one single
button. Meaning they want to save record, close this form
(frmRegistration and then open
"frmSummary" which displays the specific record.
>I tried using macro to achieve this but somehow it is returning me an
error as it does not open specific record in frmSummary. Can anyone
please help me achieve this?
>Thanks a lot.- Hide quoted text -

- Show quoted text -
Jan 31 '07 #4

This discussion thread is closed

Replies have been disabled for this discussion.