closing forms

kwtmd

Registered User.
Local time
Today, 14:52
Joined
May 21, 2004
Messages
46
I seem to have difficulty closing a form. In VBA when opening a new form, i want the previous form to close. I am using the docmd.close "formname" without success. any ideas?
 
Try using this code: DoCmd.Close acForm, "form name"

hth,
Michael
 
Code:
DoCmd.Close acForm, Me.Name
 
had tried that already without success?
 
Code:
Private Sub btnOpenMyForm_Click()
    
    DoCmd.OpenForm "frmMyForm", acNormal
    DoCmd.Close acForm, Me.Name
    
End Sub
 
if i understand correctly you want to open a specified form upon the closing of a form use this on the onclose event of you opened form

docmd.openform "FormName"

you above code is also ok but all you have to do is rearrange it, place the close code first and open code after. first it will close a form and then open other

this would work fine then...
 
thanks...seems to work with the me.name..... why?
 

Users who are viewing this thread

Back
Top Bottom