Open a form and close one

S

Simon

I have a button on frmOrderProductAdd that opens frmOrder , Please see
below code
It opens up frmORder fine but at same time i want to close
frmORderProductAdd. Where would i add the code and what code do i need

Thansk



Private Sub Command74_Click()
On Error GoTo Err_Command74_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "frmOrder"

stLinkCriteria = "[OrderNumber]=" & Me![OrderNumber]
DoCmd.OpenForm stDocName, , , stLinkCriteria



Exit_Command74_Click:
Exit Sub

Err_Command74_Click:
MsgBox Err.Description
Resume Exit_Command74_Click


End Sub
 
L

Larry Linson

Have you tried inserting it between these two lines, as:
stLinkCriteria = "[OrderNumber]=" & Me![OrderNumber] DoCmd.Close
DoCmd.OpenForm stDocName, , , stLinkCriteria

Larry Linson
Microsoft Office Access MVP

Simon said:
I have a button on frmOrderProductAdd that opens frmOrder , Please see
below code
It opens up frmORder fine but at same time i want to close
frmORderProductAdd. Where would i add the code and what code do i need

Thansk



Private Sub Command74_Click()
On Error GoTo Err_Command74_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "frmOrder"

stLinkCriteria = "[OrderNumber]=" & Me![OrderNumber]
DoCmd.OpenForm stDocName, , , stLinkCriteria



Exit_Command74_Click:
Exit Sub

Err_Command74_Click:
MsgBox Err.Description
Resume Exit_Command74_Click


End Sub
 

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

Similar Threads

Open new form 1
New Record 0
Subform 0
search command 2
transfer a field using button 1
Code Only works first time! 2
Multiple Search Command criteria in a form 2
popup issue if no existing record 1

Top