Quantcast
Channel: VBForums - Visual Basic 6 and Earlier
Viewing all articles
Browse latest Browse all 21278

[RESOLVED] Possibly simple SQL query

$
0
0
I hope you can help.
I have a program with 2 tables. Customer and Address.
When next is clicked customer is iterated through, not address.
I want a search function that returns only customers of a certain postcode.
In access the code is

SELECT Customer.*
FROM Customer INNER JOIN Address ON Customer.Customer_ID = Address.Customer_ID
WHERE (((Address.Postcode)="NG9 6ex"));

However in VB this obviously doesn't work and I cannot work out how to translate this.
I am using adodc - adoCustomer and adoAddress.

The current code I have which is not working is

TheSQL = "Select * FROM Customer WHERE EXISTS(Select * FROM Address WHERE Postcode = '" & txtSearchPostcode.Text & "');"

adoCustomer.CommandType = adCmdText
adoCustomer.RecordSource = TheSQL
adoCustomer.Refresh


Hope you can help as this seems like a simple thing, its just hurting that I cannot overcome this problem.

Viewing all articles
Browse latest Browse all 21278

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>