software is fun software is fun - 4 months ago 27
C# Question

select fields from multiple tables with MSACCESS?

SELECT SignIn.VisitorFirstName As [First Name], SignIn.VisitorLastName As [Last Name], SignIn.SignInDateTime As [Sign In Time] FROM SignIn WHERE (((SignIn.[Complete])=No));


SignIn table also has a field called SignIn.PersonID

I have a PersonTable that has the following fields

ID - AutoNumber
First Name - Long Text
Last Name - Long Text


I need to get the Name (First and Last) from the PersonTable but using the Select Query I posted.

Not sure how I can accomplish this and I would appreciate it

Answer

Have you tried using a INNER JOIN Clause?

Something like this

SELECT 
      SignIn.VisitorFirstName As [First Name], 
      SignIn.VisitorLastName As [Last Name], 
      SignIn.SignInDateTime As [Sign In Time] 
      PersonTable.First,
      PersonTable.Last
 FROM SignIn 
 INNER JOIN PersonTable ON PersonTable.ID = SignIn.PersonID
 WHERE (((SignIn.[Complete])=No));