SQL query with multiple tables

Good afternoon experts,
I have a table called dbClinics, that populates a combobox. When the record is saved in the main table, dbMaster, it saves the cID instead of the ClinicName. I am trying to write a SQL query that looks something like:

SELECT [Last Name] & ", " & [First Name] AS FullName, [Anti-Terrorism] AS [Expiration Date], [Section]
FROM dbMaster
WHERE Category='MIL' And [cbAnti-Terrorism]=-1 And [Anti-Terrorism]<=date();

This query works just fine, however, the [section] is giving me the cID and I want the ClinicName. Any suggestions?

Thank you.
V/R,
Shannon
LVL 1
ShannonCallahanAsked:
Who is Participating?
 
Rey Obrero (Capricorn1)Connect With a Mentor Commented:
oops, change form! to forms!

dc.Clinic = forms!formReportSelection!cboReportOptions
0
 
Rey Obrero (Capricorn1)Connect With a Mentor Commented:
try this query


SELECT dm.[Last Name] & ", " & dm.[First Name] AS FullName, dm.[Anti-Terrorism] AS [Expiration Date], dm.[Section], dc.ClinicName
FROM dbMaster as dm inner join dbClinics dc on dm.Section=dc.cId
WHERE dm.Category='MIL' And dm.[cbAnti-Terrorism]=-1 And dm.[Anti-Terrorism]<=date();
0
 
ShannonCallahanAuthor Commented:
Capricorn,
I got a error message:

"type mismatch in expression"

V/R,
Shannon
0
Improve Your Query Performance Tuning

In this FREE six-day email course, you'll learn from Janis Griffin, Database Performance Evangelist. She'll teach 12 steps that you can use to optimize your queries as much as possible and see measurable results in your work. Get started today!

 
ShannonCallahanAuthor Commented:
Acutally got it working, I just had to change cID from auto number to text, but I forgot a peice of the puzzle;

I need the last part of the WHERE clause is to something like;

WHERE blah and blah and blah and dm.cID = cboClinic.selectedvalue

cboClinic is a combo box.
Any suggestions?
V/R,
Shannon
0
 
Rey Obrero (Capricorn1)Connect With a Mentor Commented:
WHERE blah and blah and blah and dm.cID = Form!NameOfForm!cboClinic
0
 
ShannonCallahanAuthor Commented:
Tried:

WHERE dm.Category='MIL' And dm.[cbAnti-Terrorism]=-1 And dc.Clinic = form!formReportSelection!cboReportOptions And dm.[Anti-Terrorism]<=date();

and it is asking me for a Perameter value?

V/R,
Shannon
0
 
ShannonCallahanAuthor Commented:
Thank you for your help!!
V/R,
Shannon
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.