A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Still struggling with DCount



 
 
Thread Tools Display Modes
  #1  
Old November 6th, 2009, 03:20 PM posted to microsoft.public.access.forms
scottyboyb
external usenet poster
 
Posts: 36
Default Still struggling with DCount

I am still strugling with understanding DCount. I don't know why I can't get
it.

Does DCount work in forms and subforms? If so, what is wrong with this:

DCount("[AmoutPledged]","Forms![Campaign Pledge Listing
Subform]","[AmountPledged] '0' ")

AmountPledged = currency field in table
Campaign Pledge Listing Subform = subform that holds AmountPledged

As I understand it, DCount says to count the records in the field xxx in the
table or query or form xxx where field xxx meets this criteria. In this case
the field AmountPledged in the subform Campaign Pledge Listing Subform where
AmountPledged 0.

Many thanks,
Scott
  #2  
Old November 6th, 2009, 04:30 PM posted to microsoft.public.access.forms
RonaldoOneNil
external usenet poster
 
Posts: 345
Default Still struggling with DCount

DCount does not work with forms, only Tables and Queries. A form's
recordsource is also a table or query so you do not need it to apply to
forms, you can use the underlying table or query.

DCount("[A Field in Table or Query]","[Query or Table
Name]","]","[AmountPledged] 0")

"scottyboyb" wrote:

I am still strugling with understanding DCount. I don't know why I can't get
it.

Does DCount work in forms and subforms? If so, what is wrong with this:

DCount("[AmoutPledged]","Forms![Campaign Pledge Listing
Subform]","[AmountPledged] '0' ")

AmountPledged = currency field in table
Campaign Pledge Listing Subform = subform that holds AmountPledged

As I understand it, DCount says to count the records in the field xxx in the
table or query or form xxx where field xxx meets this criteria. In this case
the field AmountPledged in the subform Campaign Pledge Listing Subform where
AmountPledged 0.

Many thanks,
Scott

  #3  
Old November 6th, 2009, 06:35 PM posted to microsoft.public.access.forms
John W. Vinson
external usenet poster
 
Posts: 18,261
Default Still struggling with DCount

On Fri, 6 Nov 2009 07:20:02 -0800, scottyboyb
wrote:

I am still strugling with understanding DCount. I don't know why I can't get
it.

Does DCount work in forms and subforms? If so, what is wrong with this:

DCount("[AmoutPledged]","Forms![Campaign Pledge Listing
Subform]","[AmountPledged] '0' ")

AmountPledged = currency field in table
Campaign Pledge Listing Subform = subform that holds AmountPledged

As I understand it, DCount says to count the records in the field xxx in the
table or query or form xxx where field xxx meets this criteria. In this case
the field AmountPledged in the subform Campaign Pledge Listing Subform where
AmountPledged 0.

Many thanks,
Scott


Data is not stored in Forms.

The domain functions (such as DLookup and DCount) retrieve data from Tables or
Queries. They do not retrive data from Forms. The second argument of the
function must be the name of either a Table or a Query.

Use the query that is the recordsource of the Subform; you may need an
additional criterion if you want to retrieve a particular member's
contributions (I don't know the structure of your form or tables so I can't
specify what that would be).
--

John W. Vinson [MVP]
  #4  
Old November 7th, 2009, 03:26 AM posted to microsoft.public.access.forms
scottyboyb
external usenet poster
 
Posts: 36
Default Still struggling with DCount

Thanks for the reply. I appreciate the explanation. I have put your solution
in and I am geting a name error. I have checked all thenales and they appear
correct. Is there someplace I should be looking?

Best,
Scott


"RonaldoOneNil" wrote:

DCount does not work with forms, only Tables and Queries. A form's
recordsource is also a table or query so you do not need it to apply to
forms, you can use the underlying table or query.

DCount("[A Field in Table or Query]","[Query or Table
Name]","]","[AmountPledged] 0")

"scottyboyb" wrote:

I am still strugling with understanding DCount. I don't know why I can't get
it.

Does DCount work in forms and subforms? If so, what is wrong with this:

DCount("[AmoutPledged]","Forms![Campaign Pledge Listing
Subform]","[AmountPledged] '0' ")

AmountPledged = currency field in table
Campaign Pledge Listing Subform = subform that holds AmountPledged

As I understand it, DCount says to count the records in the field xxx in the
table or query or form xxx where field xxx meets this criteria. In this case
the field AmountPledged in the subform Campaign Pledge Listing Subform where
AmountPledged 0.

Many thanks,
Scott

  #5  
Old November 7th, 2009, 04:11 AM posted to microsoft.public.access.forms
Gina Whipp
external usenet poster
 
Posts: 3,500
Default Still struggling with DCount

Scott,

Copy/paste your new DCount here along where you are using it.

--
Gina Whipp

"I feel I have been denied critical, need to know, information!" - Tremors
II

http://www.regina-whipp.com/index_files/TipList.htm

"scottyboyb" wrote in message
...
Thanks for the reply. I appreciate the explanation. I have put your
solution
in and I am geting a name error. I have checked all thenales and they
appear
correct. Is there someplace I should be looking?

Best,
Scott


"RonaldoOneNil" wrote:

DCount does not work with forms, only Tables and Queries. A form's
recordsource is also a table or query so you do not need it to apply to
forms, you can use the underlying table or query.

DCount("[A Field in Table or Query]","[Query or Table
Name]","]","[AmountPledged] 0")

"scottyboyb" wrote:

I am still strugling with understanding DCount. I don't know why I
can't get
it.

Does DCount work in forms and subforms? If so, what is wrong with this:

DCount("[AmoutPledged]","Forms![Campaign Pledge Listing
Subform]","[AmountPledged] '0' ")

AmountPledged = currency field in table
Campaign Pledge Listing Subform = subform that holds AmountPledged

As I understand it, DCount says to count the records in the field xxx
in the
table or query or form xxx where field xxx meets this criteria. In this
case
the field AmountPledged in the subform Campaign Pledge Listing Subform
where
AmountPledged 0.

Many thanks,
Scott



  #6  
Old November 7th, 2009, 04:25 AM posted to microsoft.public.access.forms
Beetle
external usenet poster
 
Posts: 1,254
Default Still struggling with DCount

Can you post your DCount statement as it currently is?

There is an extra bracket in the example from the other
responder which you may have unknowingly placed in
yours as well.
--
_________

Sean Bailey


"scottyboyb" wrote:

Thanks for the reply. I appreciate the explanation. I have put your solution
in and I am geting a name error. I have checked all thenales and they appear
correct. Is there someplace I should be looking?

Best,
Scott


"RonaldoOneNil" wrote:

DCount does not work with forms, only Tables and Queries. A form's
recordsource is also a table or query so you do not need it to apply to
forms, you can use the underlying table or query.

DCount("[A Field in Table or Query]","[Query or Table
Name]","]","[AmountPledged] 0")

"scottyboyb" wrote:

I am still strugling with understanding DCount. I don't know why I can't get
it.

Does DCount work in forms and subforms? If so, what is wrong with this:

DCount("[AmoutPledged]","Forms![Campaign Pledge Listing
Subform]","[AmountPledged] '0' ")

AmountPledged = currency field in table
Campaign Pledge Listing Subform = subform that holds AmountPledged

As I understand it, DCount says to count the records in the field xxx in the
table or query or form xxx where field xxx meets this criteria. In this case
the field AmountPledged in the subform Campaign Pledge Listing Subform where
AmountPledged 0.

Many thanks,
Scott

  #7  
Old November 7th, 2009, 12:49 PM posted to microsoft.public.access.forms
scottyboyb
external usenet poster
 
Posts: 36
Default Still struggling with DCount

Greetings,

DCount("[AmountPledged]","[ContributorsPledgesQuery]","[Paid]=True")

I did see the extra brackets. Here is the statement as it is now.

AmountPledged is a number field. Then the query named above for Paid, a
yes/no field in the same query and field that I want to be counted for true.

Thanks,
Scott


"Beetle" wrote:

Can you post your DCount statement as it currently is?

There is an extra bracket in the example from the other
responder which you may have unknowingly placed in
yours as well.
--
_________

Sean Bailey


"scottyboyb" wrote:

Thanks for the reply. I appreciate the explanation. I have put your solution
in and I am geting a name error. I have checked all thenales and they appear
correct. Is there someplace I should be looking?

Best,
Scott


"RonaldoOneNil" wrote:

DCount does not work with forms, only Tables and Queries. A form's
recordsource is also a table or query so you do not need it to apply to
forms, you can use the underlying table or query.

DCount("[A Field in Table or Query]","[Query or Table
Name]","]","[AmountPledged] 0")

"scottyboyb" wrote:

I am still strugling with understanding DCount. I don't know why I can't get
it.

Does DCount work in forms and subforms? If so, what is wrong with this:

DCount("[AmoutPledged]","Forms![Campaign Pledge Listing
Subform]","[AmountPledged] '0' ")

AmountPledged = currency field in table
Campaign Pledge Listing Subform = subform that holds AmountPledged

As I understand it, DCount says to count the records in the field xxx in the
table or query or form xxx where field xxx meets this criteria. In this case
the field AmountPledged in the subform Campaign Pledge Listing Subform where
AmountPledged 0.

Many thanks,
Scott

  #8  
Old November 7th, 2009, 03:46 PM posted to microsoft.public.access.forms
Beetle
external usenet poster
 
Posts: 1,254
Default Still struggling with DCount

I don't immediately see anything wrong with the way that
is written. Are you putting this directly in the Control Source
of a text box on your form? If so you need to precede it
with the = sign.

=DCount("[AmountPledged]","[ContributorsPledgesQuery]","[Paid]=True")
--
_________

Sean Bailey


"scottyboyb" wrote:

Greetings,

DCount("[AmountPledged]","[ContributorsPledgesQuery]","[Paid]=True")

I did see the extra brackets. Here is the statement as it is now.

AmountPledged is a number field. Then the query named above for Paid, a
yes/no field in the same query and field that I want to be counted for true.

Thanks,
Scott


"Beetle" wrote:

Can you post your DCount statement as it currently is?

There is an extra bracket in the example from the other
responder which you may have unknowingly placed in
yours as well.
--
_________

Sean Bailey


"scottyboyb" wrote:

Thanks for the reply. I appreciate the explanation. I have put your solution
in and I am geting a name error. I have checked all thenales and they appear
correct. Is there someplace I should be looking?

Best,
Scott


"RonaldoOneNil" wrote:

DCount does not work with forms, only Tables and Queries. A form's
recordsource is also a table or query so you do not need it to apply to
forms, you can use the underlying table or query.

DCount("[A Field in Table or Query]","[Query or Table
Name]","]","[AmountPledged] 0")

"scottyboyb" wrote:

I am still strugling with understanding DCount. I don't know why I can't get
it.

Does DCount work in forms and subforms? If so, what is wrong with this:

DCount("[AmoutPledged]","Forms![Campaign Pledge Listing
Subform]","[AmountPledged] '0' ")

AmountPledged = currency field in table
Campaign Pledge Listing Subform = subform that holds AmountPledged

As I understand it, DCount says to count the records in the field xxx in the
table or query or form xxx where field xxx meets this criteria. In this case
the field AmountPledged in the subform Campaign Pledge Listing Subform where
AmountPledged 0.

Many thanks,
Scott

  #9  
Old November 7th, 2009, 09:29 PM posted to microsoft.public.access.forms
scottyboyb
external usenet poster
 
Posts: 36
Default Still struggling with DCount

I put the = sign in and now I ger a #error. DCount seems to have me on the
ropes. I have rechecked the spelling of each field and query and everything
seems fine.

I mayjsut give up and not provide this info on the form. Iti is the reports,
but I was hoping to have it on the forms where pople are working.

Best,
Scott

"Beetle" wrote:

I don't immediately see anything wrong with the way that
is written. Are you putting this directly in the Control Source
of a text box on your form? If so you need to precede it
with the = sign.

=DCount("[AmountPledged]","[ContributorsPledgesQuery]","[Paid]=True")
--
_________

Sean Bailey


"scottyboyb" wrote:

Greetings,

DCount("[AmountPledged]","[ContributorsPledgesQuery]","[Paid]=True")

I did see the extra brackets. Here is the statement as it is now.

AmountPledged is a number field. Then the query named above for Paid, a
yes/no field in the same query and field that I want to be counted for true.

Thanks,
Scott


"Beetle" wrote:

Can you post your DCount statement as it currently is?

There is an extra bracket in the example from the other
responder which you may have unknowingly placed in
yours as well.
--
_________

Sean Bailey


"scottyboyb" wrote:

Thanks for the reply. I appreciate the explanation. I have put your solution
in and I am geting a name error. I have checked all thenales and they appear
correct. Is there someplace I should be looking?

Best,
Scott


"RonaldoOneNil" wrote:

DCount does not work with forms, only Tables and Queries. A form's
recordsource is also a table or query so you do not need it to apply to
forms, you can use the underlying table or query.

DCount("[A Field in Table or Query]","[Query or Table
Name]","]","[AmountPledged] 0")

"scottyboyb" wrote:

I am still strugling with understanding DCount. I don't know why I can't get
it.

Does DCount work in forms and subforms? If so, what is wrong with this:

DCount("[AmoutPledged]","Forms![Campaign Pledge Listing
Subform]","[AmountPledged] '0' ")

AmountPledged = currency field in table
Campaign Pledge Listing Subform = subform that holds AmountPledged

As I understand it, DCount says to count the records in the field xxx in the
table or query or form xxx where field xxx meets this criteria. In this case
the field AmountPledged in the subform Campaign Pledge Listing Subform where
AmountPledged 0.

Many thanks,
Scott

  #10  
Old November 7th, 2009, 10:01 PM posted to microsoft.public.access.forms
John W. Vinson
external usenet poster
 
Posts: 18,261
Default Still struggling with DCount

On Sat, 7 Nov 2009 13:29:01 -0800, scottyboyb
wrote:

I put the = sign in and now I ger a #error. DCount seems to have me on the
ropes. I have rechecked the spelling of each field and query and everything
seems fine.

I mayjsut give up and not provide this info on the form. Iti is the reports,
but I was hoping to have it on the forms where pople are working.


Post the SQL of the query. Is AmountPledged in fact in the query? If you open
the query itself in datasheet view, does it have a Paid field, an
AmountPledged field, and the records you expect? And do you want to *count
records* (in which case the AmountPledged would appear to be irrelevant), or
*sum pledges* (in which case DSum() would be the appropriate function)?
--

John W. Vinson [MVP]
 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 10:16 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.