Hello to all,
I have a form (frm_paymentform) that has a subform (subfrm_paymentform_payment) on it. On the Form_Load event of frm_paymentform I have the following code:
In the query (qry_paymentform) that frm_paymentform is based off of, there are 2 tables being referenced (sponsoring & sponsoring_options). Each of these tables has the field (Sponsorship ID) and they are both referenced in the query.
When I open frm_paymentform and after I enter the Sponsor ID for whose records I am looking for, I get an error stating: "The Specified field '[Sponsorship ID]' could refer to more than one table listed in the FROM clause of your SQL statement".
Here is the SQL of the qry_paymentform:
How can I reference only one of the Sponsorship ID fields from VBA?
Thanks for your help!!!!
BakerUSMC
I have a form (frm_paymentform) that has a subform (subfrm_paymentform_payment) on it. On the Form_Load event of frm_paymentform I have the following code:
Code:
If DCount("[Sponsorship ID]", "qry_paymentform", "[Sponsorship ID]=" & Me.[sponsoring.Sponsorship ID]) <> "0" Then
Me.Number_of_Payments_Made = DCount("[Sponsorship ID]", "qry_paymentform", "[Sponsorship ID]=" & Me.[sponsoring.Sponsorship ID])
Else
Me.Number_of_Payments_Made = "0"
End If
In the query (qry_paymentform) that frm_paymentform is based off of, there are 2 tables being referenced (sponsoring & sponsoring_options). Each of these tables has the field (Sponsorship ID) and they are both referenced in the query.
When I open frm_paymentform and after I enter the Sponsor ID for whose records I am looking for, I get an error stating: "The Specified field '[Sponsorship ID]' could refer to more than one table listed in the FROM clause of your SQL statement".
Here is the SQL of the qry_paymentform:
Code:
SELECT sponsoring.[Sponsorship ID], sponsoring.[Orphan ID], sponsoring.[Sponsor ID], sponsoring.[Term of Sponsorship], sponsoring.[Start of Sponsorship], sponsoring.[End fo Sponsorship], sponsoring.[Payment Type], sponsoring.[Payment Schedule], sponsoring.[Total Number of Payments Due], sponsoring.[Number of Payments Made], sponsoring.[Total Amount Due], sponsoring.[Total Amount Paid], sponsoring.[Total Overdue Payments], sponsoring.[Record Active?], sponsoring.[Date Last Updated], sponsoring_options.[Needs Monthly Reminder], sponsoring_options.[Needs Semi-Annual Update], sponsoring_options.[Date last SAU sent], sponsoring_options.[Correspondence Language], sponsoring_options.[Sponsoring Status], sponsoring_options.Notes, sponsoring_options.[Correspondence Type], sponsoring_options.[Sponsorship ID]
FROM sponsoring LEFT JOIN sponsoring_options ON sponsoring.[Sponsorship ID] = sponsoring_options.[Sponsorship ID]
WHERE (((sponsoring.[Sponsorship ID]) Is Not Null) AND ((sponsoring.[Sponsor ID])=[Please enter Sponsor ID]));
How can I reference only one of the Sponsorship ID fields from VBA?
Thanks for your help!!!!
BakerUSMC