DoCmd.Close

A

Ana

Hi,
I use a dialog form to bring up a report and I'd like to close the form
automatically once the report is brought up.
The below code doesn't work. What's the solution?
TIA

Private Sub Comman2_Click()
DoCmd.OpenReport "Test", acViewPreview
DoCmd.Close
End Sub
 
K

kingston via AccessMonster.com

You probably need to specify what you want to close:

DoCmd.Close acForm, Me.Name
 
R

rahmad

Or you could try to put 'DoCmd.Close'
at the first line if you won't to specify the objects name.
 
Top