Dlookup with Inner Join

  • Thread starter Thread starter stickandrock
  • Start date Start date
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.....
 
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
 
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.....
 
Back
Top