I work for a Health Insurance Company. We contract with a number of Medical Groups. Occassionaly throughout the year we have what Joint Operations Meetings with the various Medical Groups. There are a group of 5 Reports run out of MS Access 2000 for these meetings. In addition for some of these groups we print out these same 5 reports on a quarterly basis. Ok that's the background the issue is that If I run the reports for the JOC Meeting and use the date range similar to a quarter 10/1/2010 through 12/31/2010 for example all 5 reports print no problem. If I run the batch routine to print the quarterly reports even if it's the same group as the JOC but 1 of the Report Queries errors.
I have a table that links the contact persons address with the IPA ID's for these quartely reports
Here's the code for the quarterly reports bear in mind that it does not error here.
Sub QuarterlyReports()
Dim strsql As String, oldipa As String, itm As Variant, loopctr As Long
Dim rs As New ADODB.Recordset, rsgp As New ADODB.Recordset
'This pulls all of the IPA's for the quarterly Reports
strsql = "Select ipa from tbl_mailing_groups group by ipa"
If Not IsNull(Me.txtGroupid) Then oldipa = Me.txtGroupid
rs.Open strsql, CurrentProject.Connection, adOpenForwardOnly, adLockReadOnly
Do Until rs.EOF
'set the textbox to the current IPA
Me.txtGroupid = rs!ipa
'Change the Combobox of the Provider Groups for that IPA
'To the Groups for the IPA for the Quarterly report
Call txtGroupid_Change
Refresh the Combo Box for the Provider Groups
Me.Combo10.Requery
strsql = "Select group from tbl_mailing_groups " & _
"Where ipa = """ & rs!ipa & """ Group By group"
rsgp.Open strsql, CurrentProject.Connection, adOpenForwardOnly, adLockReadOnly
Do Until rsgp.EOF
'set the Selected flag in the combo box based on the
'IPA In the Mailing List Table
For loopctr = 0 To Forms!frmJOMreports.Combo10.ListCount - 1
If Forms!frmJOMreports.Combo10.ItemData(loopctr) = rsgp!group Then
Forms!frmJOMreports.Combo10.Selected(loopctr) = True
End If
Next loopctr
rsgp.MoveNext
Loop
rsgp.Close
'Print the reports
Call cmdprintScoresReport_Click
rs.MoveNext
Loop
rs.Close
Set rs = Nothing
End Sub
The call cmdprintscoresreport_click calls the command button used when printing the JOC Report
There is 1 column in the query that errors where the column name is eff_date the Criteria = Between CVDate(format(forms!frmReport!dtstart,"mm/dd/yyyy")) and CVDate(format(forms!frmreport!dtend,"mm/dd/yyyy")) If the criteria is in the query it errors if I take it out it works, but why would it work for the JOC and not for the quarterly when everything in the report and on the form are the same?
I have a table that links the contact persons address with the IPA ID's for these quartely reports
Here's the code for the quarterly reports bear in mind that it does not error here.
Sub QuarterlyReports()
Dim strsql As String, oldipa As String, itm As Variant, loopctr As Long
Dim rs As New ADODB.Recordset, rsgp As New ADODB.Recordset
'This pulls all of the IPA's for the quarterly Reports
strsql = "Select ipa from tbl_mailing_groups group by ipa"
If Not IsNull(Me.txtGroupid) Then oldipa = Me.txtGroupid
rs.Open strsql, CurrentProject.Connection, adOpenForwardOnly, adLockReadOnly
Do Until rs.EOF
'set the textbox to the current IPA
Me.txtGroupid = rs!ipa
'Change the Combobox of the Provider Groups for that IPA
'To the Groups for the IPA for the Quarterly report
Call txtGroupid_Change
Refresh the Combo Box for the Provider Groups
Me.Combo10.Requery
strsql = "Select group from tbl_mailing_groups " & _
"Where ipa = """ & rs!ipa & """ Group By group"
rsgp.Open strsql, CurrentProject.Connection, adOpenForwardOnly, adLockReadOnly
Do Until rsgp.EOF
'set the Selected flag in the combo box based on the
'IPA In the Mailing List Table
For loopctr = 0 To Forms!frmJOMreports.Combo10.ListCount - 1
If Forms!frmJOMreports.Combo10.ItemData(loopctr) = rsgp!group Then
Forms!frmJOMreports.Combo10.Selected(loopctr) = True
End If
Next loopctr
rsgp.MoveNext
Loop
rsgp.Close
'Print the reports
Call cmdprintScoresReport_Click
rs.MoveNext
Loop
rs.Close
Set rs = Nothing
End Sub
The call cmdprintscoresreport_click calls the command button used when printing the JOC Report
There is 1 column in the query that errors where the column name is eff_date the Criteria = Between CVDate(format(forms!frmReport!dtstart,"mm/dd/yyyy")) and CVDate(format(forms!frmreport!dtend,"mm/dd/yyyy")) If the criteria is in the query it errors if I take it out it works, but why would it work for the JOC and not for the quarterly when everything in the report and on the form are the same?