Hi. I have a form with two subforms, and I'm trying to link the recordsource in Subform2 to a field in Subform1. (Subform1 is linked to data in the main form.) So I have the following code to accomplish this:
strSQL = "Select * " & _
"From RemittanceLocation " & _
"Where [UniqueName] = '" & [SupplierLocation].Form!UniqueName & "'"
Forms![Supplier]![RemittanceLocation].Form.RecordSource = strSQL
varLines = Me.RemittanceLocation!RemitToAddressPostalAddressLines.Value
SupplierLocation is Subform1, RemittanceLocation is Subform2. When I run this code, I get error 94: "Invalid use of Null" on the last line of code. (The "Value" of RemitToAddressPostalAddressLines is null.)
Yet, when I create a query with the value stored in strSQL and run it, I get results. So why isn't the recordsource of this subform getting updated?
I see the following in the immediate window:
?Me.RemittanceLocation!RemitToAddressPostalAddressLines.Value
Null
?Forms![Supplier]![RemittanceLocation].Form.RecordSource
Select * From RemittanceLocation Where [UniqueName] = 'PC0000016'
Thanks!
Scott
strSQL = "Select * " & _
"From RemittanceLocation " & _
"Where [UniqueName] = '" & [SupplierLocation].Form!UniqueName & "'"
Forms![Supplier]![RemittanceLocation].Form.RecordSource = strSQL
varLines = Me.RemittanceLocation!RemitToAddressPostalAddressLines.Value
SupplierLocation is Subform1, RemittanceLocation is Subform2. When I run this code, I get error 94: "Invalid use of Null" on the last line of code. (The "Value" of RemitToAddressPostalAddressLines is null.)
Yet, when I create a query with the value stored in strSQL and run it, I get results. So why isn't the recordsource of this subform getting updated?
I see the following in the immediate window:
?Me.RemittanceLocation!RemitToAddressPostalAddressLines.Value
Null
?Forms![Supplier]![RemittanceLocation].Form.RecordSource
Select * From RemittanceLocation Where [UniqueName] = 'PC0000016'
Thanks!
Scott