Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Access 2007 subform recordset issue

Status
Not open for further replies.

rss0213

Programmer
Jul 12, 2007
58
US
Hi. Trying to assign the recordset of subform B (frmRemittanceLocation) to records from a table that are related to a value in subform A (frmSupplierLocation), but the query is not returning any results (and I've validated that the data is there). Here is the code:


strSQL = "Select * From tblRemittanceLocation " & _
"Where tblRemittanceLocation!UniqueName = '" & _
Me.frmSupplierLocation!UniqueName.Value & "'"

Me.frmRemittanceLocation.Form.RecordSource = strSQL
Me.frmRemittanceLocation.Form.Requery

varLines = Me.frmRemittanceLocation!RemitToAddressPostalAddressLines.Value


This code is executed in the Current event of the main form. In the immediate window, I have exactly the SQL command that I want:



Select * From tblRemittanceLocation Where tblRemittanceLocation!UniqueName = 'PC0000016'



But the recordcount of this recordsource is 0. I'm stumped.

Thanks!
Scott
 
How are ya rss0213 . . .

Your not referencing the subform properly. Try:
Code:
[blue]strSQL = "Select * " & _
         "From tblRemittanceLocation " & _
      	 "Where [UniqueName] = '" & [frmSupplierLocation][purple][b].Form![/b][/purple]UniqueName & "'"[/blue]

See Ya! . . . . . .

Be sure to see thread181-473997 [blue]Worthy Reading![/blue] [thumbsup2]
Also faq181-2886 [blue]Worthy Reading![/blue] [thumbsup2]
 
Thanks for the tip AceMan, but it's still not returning any records. The strSQL variable contains this SQL command:

Select * From RemittanceLocation Where [UniqueName] = 'PC0000016'

but the resulting record set is empty.

Thanks!
Scott
 
and I've validated that the data is there
Really ?
How did you that ?
Did you past the value of strSQL in the SQL view pane of a brand new query ?

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
yessir, but I'm having problems uploading the results doc to a file share site. Probably because I'm behind the corp. firewall. I can email them to you if you like?

Thanks!
Scott
 
Anyone see anything after I uploaded the query results?

Thanks!
Scott
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top