opening forms

F

Fie

hey,

am trying to get a form to open when i open up a report... that allows
user to enter in data range which is parameters from a query, but on
the On Open even in the report iv attached the followen code...

Private Sub Report_Open(Cancel As Integer)
' Open Sales by Year Dialog form.
' IsLoaded function (defined in Utility Functions module) determines
' if specified form is open.

Dim strDocName As String

strDocName = "frmDate"
' Set public variable to True so Sales by Year Dialog knows that
report
' is in its Open event.
blnOpening = True

' Open form.
DoCmd.OpenForm strDocName, , , , , acDialog

' If Sales by Year Dialog form isn't loaded, don't preview or print
report.
' (User clicked Cancel button on form.)
If IsLoaded(strDocName) = False Then Cancel = True

'Set public variable to False, signifying that Open event is
finished.
blnOpening = False
End Sub


but it highlights the followen lines when the code is run

Private Sub Report_Open(Cancel As Integer)
blnOpening = True


am working in access 97... has anyone any ideas how to solve this
ppppppppppppppplllllllllllllllllllllleeeeeeeeeeeeaaaaaaaasse help...

fie
 
G

Gordon Padwick

I think you have things the wrong way round.

As I understand it, a report is intended to print already prepared data. A
form is intended to be used to enter data thst might subsequently be
displayed or printed.

You need to use a form first to create your data. After you've created the
data, then use a report to display or print it.

Gordon
 

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

Similar Threads


Top