Pulling data from multiple tables
Posted on 2001-06-24
Yet another Data question!
Hi - I need to pull data from multiple tables that match,
Example: Using the code below I can get data from 1 table, but not more - I need to do something simular to below - except pull the customer or vendor info from another table, Does this require relationships? Or a join?
Dim strSQL As String
'If txtSKUNum.Text = txtLastSKU Then Exit Sub
'txtLastSKU = txtSKUNum.Text
strSQL = "SELECT ItemDesc, SellPrice,Category,Type,Image from NewItems " & _
"Where ItemDesc like '" & "%" & Text1.Text & "%'"
On Error Resume Next
On Error GoTo 0
rs.Open strSQL, cn, adOpenForwardOnly, adLockReadOnly
If Text1.Text = "" Then
MsgBox "Please enter a search term"
Do Until rs.EOF = True
Check = rs!Itemdesc
'If rs.EOF = True And Check = "" Then
'MsgBox "Sorry No matches found"
List2.AddItem Format(rs!SellPrice, "$####.##")
If rs.EOF = True And Check = "" Then
MsgBox "Sorry No matches found"
Set rs = Nothing
All's I get are errors when I attempt to pull data from multiple tables - This is an access database, what I would need is something like:
Select Customer, InvoiceNum, Item,Date,CheckNum,Image From Customers, Items, Invoices Where InvoiceNum = Text1.text.
All's I get is alot of errors when I try anything like this.