Hi all
First post so be gentle
I've currently got a temp job building an Access DB for client to include details of various contacts, site names etc. This will be used to craete batch letters, send out reports and the like.
I'm unfortunately stuck at the batch letters. I've built a query that's accessing various tables and outputting to a formatted report. Letters are accessed by a pop-up form that ask for user input on two combo boxes before previewing or printing.
Problem is that upon selecting both options and clicking either preview or print the form does not disappear and the report hangs in the background, only disappearing when I cancel the form.
When I run this report direct from the query I get two pop up dialogue boxes asking for me to input the exact text from the tables its referencing but, if entered correctly, this way works fine.
The code I'm using behind the report is below. I don't have any behind the form itself, which may be the problem (???)
Hedlp would be appreciated as the temp job is running out and I want to have produced something...
Option Compare Database ' Use database order for string comparisons.
Option Explicit ' Requires variables to be declared before they are used.
' This variable set to True while the Report_Open event is executing.
Public blnOpening As Boolean
Private Sub Report_Open(Cancel As Integer)
' Open Form1 form.
' IsLoaded function (defined in Utility Functions module) determines
' if specified form is open.
Dim strDocName As String
strDocName = "Form1"
' Set public variable to True so Form1 knows that report
' is in its Open event.
blnOpening = True
' Open form.
DoCmd.OpenForm strDocName, , , , , acDialog
' If Form1 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
Private Sub Report_Close()
' Close the Form1 form.
Dim strDocName As String
strDocName = "Form1"
DoCmd.Close acForm, strDocName
End Sub
First post so be gentle
I've currently got a temp job building an Access DB for client to include details of various contacts, site names etc. This will be used to craete batch letters, send out reports and the like.
I'm unfortunately stuck at the batch letters. I've built a query that's accessing various tables and outputting to a formatted report. Letters are accessed by a pop-up form that ask for user input on two combo boxes before previewing or printing.
Problem is that upon selecting both options and clicking either preview or print the form does not disappear and the report hangs in the background, only disappearing when I cancel the form.
When I run this report direct from the query I get two pop up dialogue boxes asking for me to input the exact text from the tables its referencing but, if entered correctly, this way works fine.
The code I'm using behind the report is below. I don't have any behind the form itself, which may be the problem (???)
Hedlp would be appreciated as the temp job is running out and I want to have produced something...
Option Compare Database ' Use database order for string comparisons.
Option Explicit ' Requires variables to be declared before they are used.
' This variable set to True while the Report_Open event is executing.
Public blnOpening As Boolean
Private Sub Report_Open(Cancel As Integer)
' Open Form1 form.
' IsLoaded function (defined in Utility Functions module) determines
' if specified form is open.
Dim strDocName As String
strDocName = "Form1"
' Set public variable to True so Form1 knows that report
' is in its Open event.
blnOpening = True
' Open form.
DoCmd.OpenForm strDocName, , , , , acDialog
' If Form1 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
Private Sub Report_Close()
' Close the Form1 form.
Dim strDocName As String
strDocName = "Form1"
DoCmd.Close acForm, strDocName
End Sub