Opening new form and closing the present one?

E

elli

Good morning!
I made a form with command button that opens a new form. Can I put a piece
of code to close the first form in this code too? If so what piece of code
and where exactly to put it?

-elli-

Private Sub Command8_Click()
On Error GoTo Err_Command8_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "Frm1"
DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_Command8_Click:
Exit Sub

Err_Command8_Click:
MsgBox Err.Description
Resume Exit_Command8_Click

End Sub
 
D

Duane Hookom

Try something like:

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "Frm1"
DoCmd.OpenForm stDocName, , , stLinkCriteria
DoCmd.Close acForm, Me.Name
 

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