473,395 Members | 1,637 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

how to DCount in query using another field of the query as the criteria?

176 100+
Good afternoon. I'm stucked in composing the syntax for DCount expression in a select query. The query qryCustomers has CustomerID field, the DCount function uses tblLoans with LoanDate and Id fields and the expression field should be: DCount("LoanDate","tblLoans","Id=CustomerID"), but the query says it can't find the expression parameter.

note: the query does work if the experssion uses an ID number for the criteria, for example: DCount("LoanDate","Loans","Id=643")

Thanks for you kind help,
Michael.
Feb 1 '07 #1
7 31968
Rabbit
12,516 Expert Mod 8TB
Good afternoon. I'm stucked in composing the syntax for DCount expression in a select query. The query qryCustomers has CustomerID field, the DCount function uses tblLoans with LoanDate and Id fields and the expression field should be: DCount("LoanDate","tblLoans","Id=CustomerID"), but the query says it can't find the expression parameter.

note: the query does work if the experssion uses an ID number for the criteria, for example: DCount("LoanDate","Loans","Id=643")

Thanks for you kind help,
Michael.
The problem is the quotes. Nothing is evaluated if it is enclosed in quotes. What you want is DCount("LoanDate","tblLoans","Id=" & CustomerID).
Feb 1 '07 #2
ADezii
8,834 Expert 8TB
Good afternoon. I'm stucked in composing the syntax for DCount expression in a select query. The query qryCustomers has CustomerID field, the DCount function uses tblLoans with LoanDate and Id fields and the expression field should be: DCount("LoanDate","tblLoans","Id=CustomerID"), but the query says it can't find the expression parameter.

note: the query does work if the experssion uses an ID number for the criteria, for example: DCount("LoanDate","Loans","Id=643")

Thanks for you kind help,
Michael.
If CustomerID is a String then:
Expand|Select|Wrap|Line Numbers
  1. DCount("LoanDate","tblLoans","Id='" & CustomerID &"'") 
Feb 1 '07 #3
Michael R
176 100+
That is right. Thanks.
Feb 1 '07 #4
NeoPa
32,556 Expert Mod 16PB
Rabbit - I have my eye on you.
You're becoming a real asset to the community! :)
Feb 1 '07 #5
Rabbit
12,516 Expert Mod 8TB
Thanks! Not as advanced as some of the others here but I try.
Feb 1 '07 #6
NeoPa
32,556 Expert Mod 16PB
Advancement is an ongoing thing.
Answering things you know is still a big contribution.
The more you know - the bigger it gets :) (or should that be :()
Feb 1 '07 #7
ADezii
8,834 Expert 8TB
Advancement is an ongoing thing.
Answering things you know is still a big contribution.
The more you know - the bigger it gets :) (or should that be :()
This Rabbit is multiplying rabbitly (LOL).
Feb 1 '07 #8

Sign in to post your reply or Sign up for a free account.

Similar topics

8
by: Steven Stewart | last post by:
Hi there, I have a query (QueryB) that is based on the results of another query (QueryA). When I open QueryB itself, it displays the exact records that I want. I have a report based on...
3
by: Bill Clark | last post by:
I have about 20,000 records pulled from Excel that I need to update. What I need to do is run an update query that bascially says: If a field is null, update it with the previous record value of...
4
by: Simon Pleasants | last post by:
Newbie question ref a database tracking orders and shipments from our foreign factories to their final destinations: I have a problem with a report I am trying to run. I have created a report,...
14
by: Darin | last post by:
I have a table that I want to delete specific records from based on data in other tables. I'm more familiar with Access '97, but am now using 2003, but the database is in 2000 format. In '97, I...
7
by: keliie | last post by:
Hello Just a quick question that I've spent a few hours trying to solve with no luck (although one would think this should be fairly easy). I have a form with a subform. The subform is based...
7
by: Daron | last post by:
In my SQL I have a column that returns a boolean value (-1 or 0), no problem. I need to be able to only see the records that return a 0 (False). I can sort and bring these to the top. When I...
8
by: Roland Hall | last post by:
In Access you use "*" + + "*", + can be replaced with & Calling a parameterized query in Access requires % be used in place of *, however, all that I have read show dynamic SQL passed to Access: ...
4
by: Stan | last post by:
I am using MS Office Access 2003 (11.5614). My basic question is can I run a query of a query datasheet. I want to use more that one criteria and can not get that query to work. I thought I...
2
by: sconard | last post by:
I cannot seem to refer to a derived field in criteria. Better phrased: I cannot refer to a derived field in the where clause of the query. The following does not use the value from the derived...
2
by: tomric | last post by:
I have a question on passing data to the criteria of a parameter of a parameter query using VBA. I have a query set up that has ten different fields in it. One is field named “status”, this field...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.