Open a form and close one

  • Thread starter Thread starter Simon
  • Start date Start date
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
 
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
 
Back
Top