Close Command Button

Dave Titan

Registered User.
Local time
Today, 06:29
Joined
Jan 1, 2002
Messages
69
Can some one please tell me the code to close a form that as command button is set in that opens another form??

In other words I click on the command button on a form, that for opens and another form opens.

I have everything except how to close the old form that the command button is on.

Here's the code I have :

Private Sub Daily_Dave_Click()
On Error GoTo Err_Daily_Dave_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "Frm Daily Stats Dave"
DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_Daily_Dave_Click:
Exit Sub

Err_Daily_Dave_Click:
MsgBox Err.Description
Resume Exit_Daily_Dave_Click

End Sub
 
just add

docmd.close acform, "FORMNAMEHERE", (then you have a choice to save, just close or have a prompt.)

HTH
 
Thanks for that.

Worked a charm, and a lot easier than making lots of little Macros!!

Cheers

Dave
 

Users who are viewing this thread

Back
Top Bottom