M
mrazanaqvee
Hi
I would really appreciate if someone could direct me towards a good
reference on DLookup/DCount usage and syntax. It seems failry straightforward
command but when it involves combination of criteria, simply fails. The
following is an example where I am stuck and would really appreciate input
from you guys.
I have a table named "tblAdvEv" in which are recorded adverse events for
every "Subject code" which may or may not be serious. This is recorded with a
Yes/No tickbox. On a subform "sfmVisitstatus" (on the parent form [Main
details]) there is a field which is updated with the On Current event of the
subform. I am trying get two pieces of info from the tblAdvEv table.
1. How many Adv events were encountered for each Subject code
2. How many Serious Adverse Events were encountered for each Subject code
The code which achieves counting (1) works perfectly
'Update AE count
str1 = "[Subject code]='" & Me.Subject_code & "'"
str = DCount("[Subject code]", "tblAdvEv", str1)
Me.SECount = str
But when I try to combine two criteria Subject code and [Serious Adverse
Event?]=True, it fails giving a type mismatch error:
'Update SAE count
str1 = "[Subject code]='" & Me.Subject_code & "'"
str2 = "[Serious Adverse Events?]=-1"
str = DCount("[Subject code]", "tblAdvEv", str1 And str2)
Me.Serious = str
I have tried different things: using criteria directly into the DCount
statement and trying different possibilities described in
http://www.mvps.org/access/general/gen0018.htm
but to no avail. Please help
I would really appreciate if someone could direct me towards a good
reference on DLookup/DCount usage and syntax. It seems failry straightforward
command but when it involves combination of criteria, simply fails. The
following is an example where I am stuck and would really appreciate input
from you guys.
I have a table named "tblAdvEv" in which are recorded adverse events for
every "Subject code" which may or may not be serious. This is recorded with a
Yes/No tickbox. On a subform "sfmVisitstatus" (on the parent form [Main
details]) there is a field which is updated with the On Current event of the
subform. I am trying get two pieces of info from the tblAdvEv table.
1. How many Adv events were encountered for each Subject code
2. How many Serious Adverse Events were encountered for each Subject code
The code which achieves counting (1) works perfectly
'Update AE count
str1 = "[Subject code]='" & Me.Subject_code & "'"
str = DCount("[Subject code]", "tblAdvEv", str1)
Me.SECount = str
But when I try to combine two criteria Subject code and [Serious Adverse
Event?]=True, it fails giving a type mismatch error:
'Update SAE count
str1 = "[Subject code]='" & Me.Subject_code & "'"
str2 = "[Serious Adverse Events?]=-1"
str = DCount("[Subject code]", "tblAdvEv", str1 And str2)
Me.Serious = str
I have tried different things: using criteria directly into the DCount
statement and trying different possibilities described in
http://www.mvps.org/access/general/gen0018.htm
but to no avail. Please help