Dlookup with Inner Join

S

stickandrock

I need to do a count on nbr of records retrieved from a dlookup query.

Table 1
Donor ID
Group ID

Table 2
Group ID (Relationship to Table 1 - Group ID)
Group Name
Group Category

I am attemping to do a count on Table1 (Donor ID) where Table2 (Group Name)
is = to "Mission" and I am just not sure how to code the inner join to Table
2

Any and all input would be greatly appreciated.....
 
J

Jeanette Cunningham

Hi stickandrock,
create a saved query based on both tables.
Use the fields DonorID and GroupName in the query.
Here's sample code based on a query called qCountDonorGroup

Dim lngCount as Long
Dim strCriteria as String

If Len(Me.GroupName) > 0 Then
strCriteria = "[GroupName] = 'mission'"
lngCount = DCount("*", "qCountDonorGroup", strCriteria)
End If

Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia
 
S

stickandrock

Jeanette:

Thanks for this solution.... I was not aware that you could reference a
query in a lookup such as that.....

Your solution has made me a smarter programmer and that not easy for an
individual with a screen name of "stick and rock" haha....

have a great day.

Jeanette Cunningham said:
Hi stickandrock,
create a saved query based on both tables.
Use the fields DonorID and GroupName in the query.
Here's sample code based on a query called qCountDonorGroup

Dim lngCount as Long
Dim strCriteria as String

If Len(Me.GroupName) > 0 Then
strCriteria = "[GroupName] = 'mission'"
lngCount = DCount("*", "qCountDonorGroup", strCriteria)
End If

Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia


stickandrock said:
I need to do a count on nbr of records retrieved from a dlookup query.

Table 1
Donor ID
Group ID

Table 2
Group ID (Relationship to Table 1 - Group ID)
Group Name
Group Category

I am attemping to do a count on Table1 (Donor ID) where Table2 (Group
Name)
is = to "Mission" and I am just not sure how to code the inner join to
Table
2

Any and all input would be greatly appreciated.....
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top