PC Review


Reply
Thread Tools Rate Thread

Dcount in Query

 
 
=?Utf-8?B?Um9iZXJ0X0R1Yllh?=
Guest
Posts: n/a
 
      17th Feb 2006
I am having trouble creating an expression in the following query:

SELECT [tblCitemRunQty-Step5-CItemsOnly].Child,
[tblCitemRunQty-Step5-CItemsOnly].Month,
[tblCitemRunQty-Step5-CItemsOnly].Branch,
DCount("Month","tblCitemRunQty-Step5-CItemsOnly","[Branch] = " & [Branch]) AS
Expr1
FROM [tblCitemRunQty-Step5-CItemsOnly];

the problem is in my Dcount statement:

DCount("Month","tblCitemRunQty-Step5-CItemsOnly","[Branch] = " &
'[Branch]').

I do not use this function much so I must refresh my self each time and this
time I am failing.

I am trying to make this statement dynamic in the query. If I use a static
value I get the result I would expect

example:

DCount("Month","tblCitemRunQty-Step5-CItemsOnly","[Branch] = 'myvalue'"

any clue on what I am doing wrong?

thanks as always.
 
Reply With Quote
 
 
 
 
Wayne Morgan
Guest
Posts: n/a
 
      17th Feb 2006
> DCount("Month","tblCitemRunQty-Step5-CItemsOnly","[Branch] = " &
> '[Branch]')


Are you trying to concatenate in the current value of Branch? If so, try:

DCount("Month","tblCitemRunQty-Step5-CItemsOnly","[Branch] = '" & [Branch] &
"'")

--
Wayne Morgan
MS Access MVP


"Robert_DubYa" <(E-Mail Removed)> wrote in message
news:33D647E8-95F8-46DF-AA84-(E-Mail Removed)...
>I am having trouble creating an expression in the following query:
>
> SELECT [tblCitemRunQty-Step5-CItemsOnly].Child,
> [tblCitemRunQty-Step5-CItemsOnly].Month,
> [tblCitemRunQty-Step5-CItemsOnly].Branch,
> DCount("Month","tblCitemRunQty-Step5-CItemsOnly","[Branch] = " & [Branch])
> AS
> Expr1
> FROM [tblCitemRunQty-Step5-CItemsOnly];
>
> the problem is in my Dcount statement:
>
> DCount("Month","tblCitemRunQty-Step5-CItemsOnly","[Branch] = " &
> '[Branch]').
>
> I do not use this function much so I must refresh my self each time and
> this
> time I am failing.
>
> I am trying to make this statement dynamic in the query. If I use a
> static
> value I get the result I would expect
>
> example:
>
> DCount("Month","tblCitemRunQty-Step5-CItemsOnly","[Branch] = 'myvalue'"
>
> any clue on what I am doing wrong?
>
> thanks as always.



 
Reply With Quote
 
=?Utf-8?B?Um9iZXJ0X0R1Yllh?=
Guest
Posts: n/a
 
      19th Feb 2006
Wayne,

Thanks for your reponse. I am trying to count the number of instances a
value appears in the month column where the value in the "Branch" = the value
in the query.

thanks,
Robert

"Wayne Morgan" wrote:

> > DCount("Month","tblCitemRunQty-Step5-CItemsOnly","[Branch] = " &
> > '[Branch]')

>
> Are you trying to concatenate in the current value of Branch? If so, try:
>
> DCount("Month","tblCitemRunQty-Step5-CItemsOnly","[Branch] = '" & [Branch] &
> "'")
>
> --
> Wayne Morgan
> MS Access MVP
>
>
> "Robert_DubYa" <(E-Mail Removed)> wrote in message
> news:33D647E8-95F8-46DF-AA84-(E-Mail Removed)...
> >I am having trouble creating an expression in the following query:
> >
> > SELECT [tblCitemRunQty-Step5-CItemsOnly].Child,
> > [tblCitemRunQty-Step5-CItemsOnly].Month,
> > [tblCitemRunQty-Step5-CItemsOnly].Branch,
> > DCount("Month","tblCitemRunQty-Step5-CItemsOnly","[Branch] = " & [Branch])
> > AS
> > Expr1
> > FROM [tblCitemRunQty-Step5-CItemsOnly];
> >
> > the problem is in my Dcount statement:
> >
> > DCount("Month","tblCitemRunQty-Step5-CItemsOnly","[Branch] = " &
> > '[Branch]').
> >
> > I do not use this function much so I must refresh my self each time and
> > this
> > time I am failing.
> >
> > I am trying to make this statement dynamic in the query. If I use a
> > static
> > value I get the result I would expect
> >
> > example:
> >
> > DCount("Month","tblCitemRunQty-Step5-CItemsOnly","[Branch] = 'myvalue'"
> >
> > any clue on what I am doing wrong?
> >
> > thanks as always.

>
>
>

 
Reply With Quote
 
Wayne Morgan
Guest
Posts: n/a
 
      21st Feb 2006
In that case, you'll have to concatenate in the value as previously
recommended. Also, the syntax you were using would be for Branch as a text
value. If it is a number data type, the syntax will change to:

DCount("Month","tblCitemRunQty-Step5-CItemsOnly","[Branch] = " & [Branch])


--
Wayne Morgan
MS Access MVP


"Robert_DubYa" <(E-Mail Removed)> wrote in message
news:26BC3291-A0B3-4EEC-B797-(E-Mail Removed)...
> Wayne,
>
> Thanks for your reponse. I am trying to count the number of instances a
> value appears in the month column where the value in the "Branch" = the
> value
> in the query.
>
> thanks,
> Robert
>
> "Wayne Morgan" wrote:
>
>> > DCount("Month","tblCitemRunQty-Step5-CItemsOnly","[Branch] = " &
>> > '[Branch]')

>>
>> Are you trying to concatenate in the current value of Branch? If so, try:
>>
>> DCount("Month","tblCitemRunQty-Step5-CItemsOnly","[Branch] = '" &
>> [Branch] &
>> "'")
>>
>> --
>> Wayne Morgan
>> MS Access MVP
>>
>>
>> "Robert_DubYa" <(E-Mail Removed)> wrote in message
>> news:33D647E8-95F8-46DF-AA84-(E-Mail Removed)...
>> >I am having trouble creating an expression in the following query:
>> >
>> > SELECT [tblCitemRunQty-Step5-CItemsOnly].Child,
>> > [tblCitemRunQty-Step5-CItemsOnly].Month,
>> > [tblCitemRunQty-Step5-CItemsOnly].Branch,
>> > DCount("Month","tblCitemRunQty-Step5-CItemsOnly","[Branch] = " &
>> > [Branch])
>> > AS
>> > Expr1
>> > FROM [tblCitemRunQty-Step5-CItemsOnly];
>> >
>> > the problem is in my Dcount statement:
>> >
>> > DCount("Month","tblCitemRunQty-Step5-CItemsOnly","[Branch] = " &
>> > '[Branch]').
>> >
>> > I do not use this function much so I must refresh my self each time and
>> > this
>> > time I am failing.
>> >
>> > I am trying to make this statement dynamic in the query. If I use a
>> > static
>> > value I get the result I would expect
>> >
>> > example:
>> >
>> > DCount("Month","tblCitemRunQty-Step5-CItemsOnly","[Branch] = 'myvalue'"
>> >
>> > any clue on what I am doing wrong?
>> >
>> > thanks as always.

>>
>>
>>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Dcount in a query zufie Microsoft Access Queries 1 3rd Aug 2009 07:52 PM
Dcount in a query zufie Microsoft Access Queries 3 3rd Aug 2009 07:24 PM
Dcount in query Radhika Microsoft Access 4 12th Jun 2008 06:35 AM
dcount in query =?Utf-8?B?SWFu?= Microsoft Access Queries 8 11th Feb 2007 04:40 AM
DCount in query Roger Epps Microsoft Access Queries 3 10th Aug 2003 09:00 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:14 AM.