adding criteria from table

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi:

intStore = DCount("[Assignee]", "[tblAssignment]", "[Assignee] =" & "'" &
Me![txtAlias] & "'" And [Status] = No)

I used the above codes to count the Assignee from tblAssignement where
txtAlias in my form matches the value AND that the [Status] in my
tblAssignment is NO. I'm getting an error. It work fine if I omit the second
criteria. Thanks in advance.
 
Try this with the And... inside the quotes.

intStore = DCount("[Assignee]", "[tblAssignment]",
"[Assignee] =""" & Me![txtAlias] & """ And [Status] = False")
 
Hi Duane:

It works, thank you for the speedy reply.
I want to understand the purpose of using the ampersand after the equal
sign in "[Assignee] =" & "'" & Me![txtAlias] & "'" caused i just copied
it. Thank you again.
--
Allan


Duane Hookom said:
Try this with the And... inside the quotes.

intStore = DCount("[Assignee]", "[tblAssignment]",
"[Assignee] =""" & Me![txtAlias] & """ And [Status] = False")

--
Duane Hookom
MS Access MVP
--

Jologs said:
Hi:

intStore = DCount("[Assignee]", "[tblAssignment]", "[Assignee] =" & "'" &
Me![txtAlias] & "'" And [Status] = No)

I used the above codes to count the Assignee from tblAssignement where
txtAlias in my form matches the value AND that the [Status] in my
tblAssignment is NO. I'm getting an error. It work fine if I omit the
second
criteria. Thanks in advance.
 
You are just concatenating two string expressions with:
"[Assignee] =" & "'"
which can be replaced by
"[Assignee] ='"
These are exactly the same. Some people use one or the other for convenience
or clarification.
--
Duane Hookom
MS Access MVP
--

Jologs said:
Hi Duane:

It works, thank you for the speedy reply.
I want to understand the purpose of using the ampersand after the equal
sign in "[Assignee] =" & "'" & Me![txtAlias] & "'" caused i just copied
it. Thank you again.
--
Allan


Duane Hookom said:
Try this with the And... inside the quotes.

intStore = DCount("[Assignee]", "[tblAssignment]",
"[Assignee] =""" & Me![txtAlias] & """ And [Status] = False")

--
Duane Hookom
MS Access MVP
--

Jologs said:
Hi:

intStore = DCount("[Assignee]", "[tblAssignment]", "[Assignee] =" & "'"
&
Me![txtAlias] & "'" And [Status] = No)

I used the above codes to count the Assignee from tblAssignement where
txtAlias in my form matches the value AND that the [Status] in my
tblAssignment is NO. I'm getting an error. It work fine if I omit the
second
criteria. Thanks in advance.
 
Hi:

I'm have a problem again the same as my previous post (counting value from
the table with two criteria) but this time one field is a number. I have
tried applying what the codes below but it returns with an error. I think,
there someting wrong with my first criteria which is a number. Test code is
below, [DescriptionID] is a number.

MsgBox DCount("[Status]", "tblAssignment", "[DescriptionID]= """" &
Me![txtDescriptionID] & """" and [Status]=True")

Many thanks.

--
Allan - http://allanmagtibay.hostrocket.com


Duane Hookom said:
You are just concatenating two string expressions with:
"[Assignee] =" & "'"
which can be replaced by
"[Assignee] ='"
These are exactly the same. Some people use one or the other for convenience
or clarification.
--
Duane Hookom
MS Access MVP
--

Jologs said:
Hi Duane:

It works, thank you for the speedy reply.
I want to understand the purpose of using the ampersand after the equal
sign in "[Assignee] =" & "'" & Me![txtAlias] & "'" caused i just copied
it. Thank you again.
--
Allan


Duane Hookom said:
Try this with the And... inside the quotes.

intStore = DCount("[Assignee]", "[tblAssignment]",
"[Assignee] =""" & Me![txtAlias] & """ And [Status] = False")

--
Duane Hookom
MS Access MVP
--

Hi:

intStore = DCount("[Assignee]", "[tblAssignment]", "[Assignee] =" & "'"
&
Me![txtAlias] & "'" And [Status] = No)

I used the above codes to count the Assignee from tblAssignement where
txtAlias in my form matches the value AND that the [Status] in my
tblAssignment is NO. I'm getting an error. It work fine if I omit the
second
criteria. Thanks in advance.
 
You should learn which types of data require which delimiters. Strings/text
generally use either single or double quotes while dates (in Access) use #.
Numbers don't need no delimiters. Try:
MsgBox DCount("[Status]", "tblAssignment", "[DescriptionID]= " &
Me![txtDescriptionID] & " and [Status]=True")

--
Duane Hookom
MS Access MVP


Jologs said:
Hi:

I'm have a problem again the same as my previous post (counting value from
the table with two criteria) but this time one field is a number. I have
tried applying what the codes below but it returns with an error. I think,
there someting wrong with my first criteria which is a number. Test code
is
below, [DescriptionID] is a number.

MsgBox DCount("[Status]", "tblAssignment", "[DescriptionID]= """" &
Me![txtDescriptionID] & """" and [Status]=True")

Many thanks.

--
Allan - http://allanmagtibay.hostrocket.com


Duane Hookom said:
You are just concatenating two string expressions with:
"[Assignee] =" & "'"
which can be replaced by
"[Assignee] ='"
These are exactly the same. Some people use one or the other for
convenience
or clarification.
--
Duane Hookom
MS Access MVP
--

Jologs said:
Hi Duane:

It works, thank you for the speedy reply.
I want to understand the purpose of using the ampersand after the
equal
sign in "[Assignee] =" & "'" & Me![txtAlias] & "'" caused i just
copied
it. Thank you again.
--
Allan


:

Try this with the And... inside the quotes.

intStore = DCount("[Assignee]", "[tblAssignment]",
"[Assignee] =""" & Me![txtAlias] & """ And [Status] = False")

--
Duane Hookom
MS Access MVP
--

Hi:

intStore = DCount("[Assignee]", "[tblAssignment]", "[Assignee] =" &
"'"
&
Me![txtAlias] & "'" And [Status] = No)

I used the above codes to count the Assignee from tblAssignement
where
txtAlias in my form matches the value AND that the [Status] in my
tblAssignment is NO. I'm getting an error. It work fine if I omit
the
second
criteria. Thanks in advance.
 
The basics is what I lack, I'm persistently trying to learn Access by myself
coz you know IT education is very expensive. I'm grateful that there are
people like you who spend their time for others. Thank you very much.

--
Allan - http://allanmagtibay.hostrocket.com


Duane Hookom said:
You should learn which types of data require which delimiters. Strings/text
generally use either single or double quotes while dates (in Access) use #.
Numbers don't need no delimiters. Try:
MsgBox DCount("[Status]", "tblAssignment", "[DescriptionID]= " &
Me![txtDescriptionID] & " and [Status]=True")

--
Duane Hookom
MS Access MVP


Jologs said:
Hi:

I'm have a problem again the same as my previous post (counting value from
the table with two criteria) but this time one field is a number. I have
tried applying what the codes below but it returns with an error. I think,
there someting wrong with my first criteria which is a number. Test code
is
below, [DescriptionID] is a number.

MsgBox DCount("[Status]", "tblAssignment", "[DescriptionID]= """" &
Me![txtDescriptionID] & """" and [Status]=True")

Many thanks.

--
Allan - http://allanmagtibay.hostrocket.com


Duane Hookom said:
You are just concatenating two string expressions with:
"[Assignee] =" & "'"
which can be replaced by
"[Assignee] ='"
These are exactly the same. Some people use one or the other for
convenience
or clarification.
--
Duane Hookom
MS Access MVP
--

Hi Duane:

It works, thank you for the speedy reply.
I want to understand the purpose of using the ampersand after the
equal
sign in "[Assignee] =" & "'" & Me![txtAlias] & "'" caused i just
copied
it. Thank you again.
--
Allan


:

Try this with the And... inside the quotes.

intStore = DCount("[Assignee]", "[tblAssignment]",
"[Assignee] =""" & Me![txtAlias] & """ And [Status] = False")

--
Duane Hookom
MS Access MVP
--

Hi:

intStore = DCount("[Assignee]", "[tblAssignment]", "[Assignee] =" &
"'"
&
Me![txtAlias] & "'" And [Status] = No)

I used the above codes to count the Assignee from tblAssignement
where
txtAlias in my form matches the value AND that the [Status] in my
tblAssignment is NO. I'm getting an error. It work fine if I omit
the
second
criteria. Thanks in advance.
 
Back
Top