I have a modal form that I open with:
DoCmd.OpenForm "DatesForm"
There is an on click event for the OK button on the form:
Private Sub Command1_Click()
DoCmd.OpenReport "MultiInvoice", acViewPreview, , "Company = '" & _
Me.CompanyNameText & "' And InvoiceDate >= #" & Me.StartDateText & _
"# And InvoiceDate <= #" & Me.EndDateText & "#", , "Group"
End Sub
... which runs a report OK, but the form does not close after the OK button is clicked, so the report is under the modal form. If I click cancel to close the form and then click on the tab to get the report I get an error: 2455. How do I get the form to close automatically and show the report without any error?
Thanks.
... Don't worry I sorted this. I used DoCmd.Close, but I made sure to store the text box values into variables beforehand.