Concatenate with a value of TRUE

  • Thread starter gmazza via AccessMonster.com
  • Start date
G

gmazza via AccessMonster.com

Hey there,
I am trying to concatenate a recordset as follows:
Set rs = CurrentDb.OpenRecordset("Select * from InclusionCriteria where
ClinicalTrialId = '" & study & "'" & " and Inactive = '" & True & "'")

It works without the last part:
& " and Inactive = '" & True & "'")

The Inactive field in my table is a Yes/No field so I just want the records
where Inactive = True.
What syntax am I getting wrong here?
Thanks in advance!
 
F

fredg

Hey there,
I am trying to concatenate a recordset as follows:
Set rs = CurrentDb.OpenRecordset("Select * from InclusionCriteria where
ClinicalTrialId = '" & study & "'" & " and Inactive = '" & True & "'")

It works without the last part:
& " and Inactive = '" & True & "'")

The Inactive field in my table is a Yes/No field so I just want the records
where Inactive = True.
What syntax am I getting wrong here?
Thanks in advance!

True is an Access constant (it's value is -1). Therefore, as a Number
value it should NOT be placed within single quotes, i.e. 'true'.

Where ClinicalTrialId = '" & study & "' and Inactive = True")
is all you need.
 
S

smartin

gmazza said:
Hey there,
I am trying to concatenate a recordset as follows:
Set rs = CurrentDb.OpenRecordset("Select * from InclusionCriteria where
ClinicalTrialId = '" & study & "'" & " and Inactive = '" & True & "'")

It works without the last part:
& " and Inactive = '" & True & "'")

The Inactive field in my table is a Yes/No field so I just want the records
where Inactive = True.
What syntax am I getting wrong here?
Thanks in advance!

True is a boolean value, not a string:

....ClinicalTrialId = '" & study & "'" & " and Inactive = True"
 
G

gmazza via AccessMonster.com

Thanks fredg!
Hey there,
I am trying to concatenate a recordset as follows:
[quoted text clipped - 8 lines]
What syntax am I getting wrong here?
Thanks in advance!

True is an Access constant (it's value is -1). Therefore, as a Number
value it should NOT be placed within single quotes, i.e. 'true'.

Where ClinicalTrialId = '" & study & "' and Inactive = True")
is all you need.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top