Query two tables and compare results

Yesuslave

Active Member
Joined
Sep 19, 2003
Messages
297
Hi all,

OK, what I need to do is query two different tables at the same time. They will have two common pieces of data, a Social Security Number, and a UID. If both exist on both sheets, I would like Access to return a Msgbox with "Match" and if not return a msgbox with "No match." I can't seem to quite figure this one out.

Thanks for any help in advance,
Josh Wise
 

Excel Facts

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.
Ok, so I figured this one out with VBA code. Basically, i just did this:

Function GetCounts(strSSN As String, strUID As String)
Dim intX
Dim intY
Dim strSN
Dim var






intX = DCount("[ssn]", "dbo_applicant", "[ssn] = '" & strSSN & "'")
intY = DCount("[SSN]", "Master List Table", "[SSN] = '" & strSSN & "'")

If intX <> 0 And intY <> 0 Then
MsgBox "There is a match"
Else
MsgBox "There is no match"
End If




End Function

Josh
 
Upvote 0

Forum statistics

Threads
1,221,638
Messages
6,160,994
Members
451,682
Latest member
ogoreo

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top