Help with the DCount function

J

Jess

I am attempting to create the following query, but I keep
getting a "Type Conversion Failure". I want to update a
Relationships Established field in a Relationship Managers
Table from the User ID field in the RMClients table using
the DCount function where the RMLastNames are equal. The
query I wrote was:

Field = RelationshipsEstablished
Table = TBL_RelationshipMangers
Update To =
DCount([UserID],"TBL_RMClients",[TBL_RMClients]![RMLastName]=[TBL_RelationshipManagers]![RMLastName])
Criteria =
[TBL_RelationshipManagers]![RMLastName]=[TBL_RMClients]![RMLastName]

I need to count the number of user IDs in a table under a
particluar Last Name and place that number in a field in
another table.

Can someone please tell me what I'm doing wrong?
 
K

Ken Snell

Your DCount syntax is incorrect, I believe. Try this:

DCount("UserID","TBL_RMClients","[RMLastName]='" &
[TBL_RelationshipManagers].[RMLastName] & "'")



--
Ken Snell
<MS ACCESS MVP>

I am attempting to create the following query, but I keep
getting a "Type Conversion Failure". I want to update a
Relationships Established field in a Relationship Managers
Table from the User ID field in the RMClients table using
the DCount function where the RMLastNames are equal. The
query I wrote was:

Field = RelationshipsEstablished
Table = TBL_RelationshipMangers
Update To =
DCount([UserID],"TBL_RMClients",[TBL_RMClients]![RMLastName]=[TBL_Relationsh
ipManagers]![RMLastName])
Criteria =
[TBL_RelationshipManagers]![RMLastName]=[TBL_RMClients]![RMLastName]

I need to count the number of user IDs in a table under a
particluar Last Name and place that number in a field in
another table.

Can someone please tell me what I'm doing wrong?
 
G

Guest

Your DCount function might be returning a Null for some entry that doesn't satisfy your criteria, and the field RelationshipsEstablished probably won't accept nulls (Required set to Yes). Either make sure there is at least one client entry for each Manager last name, or set the Required property to False. If you want to check your DCount function, just make it a field in a normal query, execute it in the QBE grid and see if there are any odd values.
 
G

Guest

Hey, I have one more question, can I add another criteria
that says to only count the records where the value in the
Duplicate field of the ClientAccounts table is blank?
 
K

Ken Snell

DCount can work on only one table or one query at a time. ClientAccounts is
not the table that you're using in the DCount expression in your post, so
the answer is no.

However, you can create a query that will return all the records from these
two tables and save the query, and then use that query name in a DCount
function.
 
G

Guest

Okay thanks.
-----Original Message-----
DCount can work on only one table or one query at a time. ClientAccounts is
not the table that you're using in the DCount expression in your post, so
the answer is no.

However, you can create a query that will return all the records from these
two tables and save the query, and then use that query name in a DCount
function.

--
Ken Snell
<MS ACCESS MVP>





.
 

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

Similar Threads

Yes/No Queries 2
Access Dcount (multiple criteria) 3
Dcount returning no results!!! 0
Help with DCOUNT syntax 2
Access MS Access DCount function problem 0
DCount Not Working Properly 7
DCount alwaysreturning 1 0
DCount with multiple conditions 2

Top