I really am trying to figure this out but just cannot get it right. I have 2 tables, "tblSalesMain" and "tblRepMain".
I am trying to return to a combobox a reps first and last name instead of an "ID". For example, when a sale is selected it will show all of the info of the sale in different controls, there will be three comboboxes with the reps that sold the item, I can get it to display the "ID" of the reps but not return the NAMES of the reps. I am an amatuer trying to learn a few things honestly, this is what I have been trying although I KNOW it is not nearly correct..

Select SaleID, RepID1, RepID2, RepID3
FROM tblSalesMain as s
INNER JOIN tblRepMain
ON s.RepID1 = tblRepMain.RepID

The tblRepMain table has "tblRepMain.RepFName" and "tblRepMain.RepLName", how can I return to a combobox the reps First and last name instead of the "ID" which currently returns for me.. ANY help will be GREATLY appreciated! Remember, I am a beginner..lol

Have you tried something like this:

Select SaleID, RepID1, RepID2, RepID3,RepFName,RepLName
FROM tblSalesMain as s, tbnlRepMain
WHERE s.RepID1 = tblRepMain.RepID

This would work in Sybase SQL, not sure about others.

Edited 3 Years Ago by Ancient Dragon

What I am trying to do is return to a combobox the "RepFName" & "RepLName" INSTEAD of an ID..For example "John Smith" has a RepID of "2"..I figured out how to return the "2" to a combobox, but not the First and Last name of the employee "John Smith" Everytime I try I get the error of non-matching datatypes, since the RepID is numeric and the RepFName & RepLName is varchar..

it's something to do with the coding of the combobox, I just cannot figure it out..Remember, I am a n00b!

This article has been dead for over six months. Start a new discussion instead.