dbaldwin117
New member
- Local time
- Today, 02:11
- Joined
- Jan 21, 2011
- Messages
- 6
I have found numerous errors in my code since posting this. I now know that trying to populate fields in a report record after opening a report is not an available option. I need to recall the syntax for opening a report with a specific record based on a field value in the current record in a form.
I am trying to select one of a group of reports, and populate its fields with values entered into a form, based on a value selected from a combo box in that form. When I run the code, with a button on click, I get an error;
Run-time error '2212'
Microsoft Office Access couldn't print your object.
Here is my code:
Private Sub Command19_Click()
Dim AcctNoStore As String
Dim LnFnStore As String
Dim LocStore As String
Dim PAOStore As Variant
AcctNoStore = Me.[Acctno]
LnFnStore = Me.[LN,FN]
LocStore = Me.[LOC]
PAOStore = Me.[UponAdmDx]
Select Case Me.[QrySeverType]
Case Is = "CHF"
DoCmd.OpenReport "rptClinDocClarRequestCHF"
Reports!rptClinDocClarRequestCHF![Acctno] = AcctNoStore
Reports!rptClinDocClarRequestCHF![LN,FN] = LnFnStore
Reports!rptClinDocClarRequestCHF![LOC] = LocStore
Case Is = "CKD"
DoCmd.OpenReport "rptClinDocClarRequestKidney"
Reports!rptClinDocClarRequestKidney![Acctno] = AcctNoStore
Reports!rptClinDocClarRequestKidney![LN,FN] = LnFnStore
Reports!rptClinDocClarRequestKidney![LOC] = LocStore
Case Is = "HTN"
DoCmd.OpenReport "rptClinDocClarRequestHypert"
Reports!rptClinDocClarRequestHypert![Acctno] = AcctNoStore
Reports!rptClinDocClarRequestHypert![LN,FN] = LnFnStore
Reports!rptClinDocClarRequestHypert![LOC] = LocStore
Case Is = "DM"
DoCmd.OpenReport "rptClinDocClarRequestDiabet"
Reports!rptClinDocClarRequestDiabet![Acctno] = AcctNoStore
Reports!rptClinDocClarRequestDiabet![LN,FN] = LnFnStore
Reports!rptClinDocClarRequestDiabet![LOC] = LocStore
Case Is = "RESP"
DoCmd.OpenReport "rptClinDocClarRequestResp"
Reports!rptClinDocClarRequestResp![Acctno] = AcctNoStore
Reports!rptClinDocClarRequestResp![LN,FN] = LnFnStore
Reports!rptClinDocClarRequestResp![LOC] = LocStore
Case Is = "POA"
DoCmd.OpenReport "rptClinDocClarRequestPOA"
Reports!rptClinDocClarRequestPOA![Acctno] = AcctNoStore
Reports!rptClinDocClarRequestPOA![LN,FN] = LnFnStore
Reports!rptClinDocClarRequestPOA![LOC] = LocStore
Reports!rptClinDocClarRequestPOA![UponAdmDx] = POAStore
End Select
End Sub
When debugging, I'm sent to the DoCmd line related to the Case Is of the choice selected from the form's combo box.
I would greatly appreciate any time attention and recommendations that might lead me to a solution to my problem.
Again, thank you so very much in advance.
I am trying to select one of a group of reports, and populate its fields with values entered into a form, based on a value selected from a combo box in that form. When I run the code, with a button on click, I get an error;
Run-time error '2212'
Microsoft Office Access couldn't print your object.
Here is my code:
Private Sub Command19_Click()
Dim AcctNoStore As String
Dim LnFnStore As String
Dim LocStore As String
Dim PAOStore As Variant
AcctNoStore = Me.[Acctno]
LnFnStore = Me.[LN,FN]
LocStore = Me.[LOC]
PAOStore = Me.[UponAdmDx]
Select Case Me.[QrySeverType]
Case Is = "CHF"
DoCmd.OpenReport "rptClinDocClarRequestCHF"
Reports!rptClinDocClarRequestCHF![Acctno] = AcctNoStore
Reports!rptClinDocClarRequestCHF![LN,FN] = LnFnStore
Reports!rptClinDocClarRequestCHF![LOC] = LocStore
Case Is = "CKD"
DoCmd.OpenReport "rptClinDocClarRequestKidney"
Reports!rptClinDocClarRequestKidney![Acctno] = AcctNoStore
Reports!rptClinDocClarRequestKidney![LN,FN] = LnFnStore
Reports!rptClinDocClarRequestKidney![LOC] = LocStore
Case Is = "HTN"
DoCmd.OpenReport "rptClinDocClarRequestHypert"
Reports!rptClinDocClarRequestHypert![Acctno] = AcctNoStore
Reports!rptClinDocClarRequestHypert![LN,FN] = LnFnStore
Reports!rptClinDocClarRequestHypert![LOC] = LocStore
Case Is = "DM"
DoCmd.OpenReport "rptClinDocClarRequestDiabet"
Reports!rptClinDocClarRequestDiabet![Acctno] = AcctNoStore
Reports!rptClinDocClarRequestDiabet![LN,FN] = LnFnStore
Reports!rptClinDocClarRequestDiabet![LOC] = LocStore
Case Is = "RESP"
DoCmd.OpenReport "rptClinDocClarRequestResp"
Reports!rptClinDocClarRequestResp![Acctno] = AcctNoStore
Reports!rptClinDocClarRequestResp![LN,FN] = LnFnStore
Reports!rptClinDocClarRequestResp![LOC] = LocStore
Case Is = "POA"
DoCmd.OpenReport "rptClinDocClarRequestPOA"
Reports!rptClinDocClarRequestPOA![Acctno] = AcctNoStore
Reports!rptClinDocClarRequestPOA![LN,FN] = LnFnStore
Reports!rptClinDocClarRequestPOA![LOC] = LocStore
Reports!rptClinDocClarRequestPOA![UponAdmDx] = POAStore
End Select
End Sub
When debugging, I'm sent to the DoCmd line related to the Case Is of the choice selected from the form's combo box.
I would greatly appreciate any time attention and recommendations that might lead me to a solution to my problem.
Again, thank you so very much in advance.
Last edited: