I have 2 separate tables that need to be joined together. I'm trying to display certain fields from both tables by joining them with a matching field(same values but different column name) The user enters their employee id, then I need to return the other field values associated with that specific id# in a datagrid.
So far I'm able to return the other field values from one of my tables according to the id# entered
-
'my connection stuff is here
-
rs.open "select swpNum, swpInfo, swpType from tblSwipes WHERE (swpNum='"& sNum &"') and swpType=1 order by etc...
-
set datagrid.datasource=rs
I'm ok up to here..The datagrid displays the 3 fields associated with the # the user enters. But I'm having trouble when I try to join tblSwipes with tblEmp to get fields returned from that table as well. Here's what I have for my new query
- rs.open "SELECT tblEmp.lastName,tblEmp.firstName, tblEmp.payNum, tblSwipes.swpNum, tblSwipes.swpType
-
FROM tblEmp INNER JOIN tblSwipes
-
ON tblEmp.payNum=tblSwipes.swpNum
-
WHERE (swpNum='"& sNum &"') and swpType=1
-
order by etc...
-
-
set datagrid2.datasource =rs
Nothing is shown in the datagrid using this query..any tips or suggestions on another way of doing this would be greatly appreciated.