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?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Rey Obrero (Capricorn1)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
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
Powerful Yet Easy-to-Use Network Monitoring

Identify excessive bandwidth utilization or unexpected application traffic with SolarWinds Bandwidth Analyzer Pack.

Rey Obrero (Capricorn1)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
Rey Obrero (Capricorn1)Commented:
oops, change form! to forms!

dc.Clinic = forms!formReportSelection!cboReportOptions
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
ShannonCallahanAuthor Commented:
Thank you for your help!!
V/R,
Shannon
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.