I'm trying to use a variable in a text string for the RecordSet.Find command.
My script looks something like this.

strKeyDiscerningCharacteristicData=objMDRDataDictionary.item("Compound")strSearchCriteria = "Compound = '"& strKeyDiscerningCharacteristicData & "'""
objRecordSet.Find strSearchCriteria

When I run this, I get the error 'Microsoft VBScript compilation error:
Unterminated string constant'. What's the correct way to set up the string
for the search criteria?
TIA
Ernie

Re: Proper Syntax for Variable Name in RecordSet.Find by James

James
Fri Jun 24 14:34:01 CDT 2005

"ebferro" <ebferro@discussions.microsoft.com> wrote in message
news:4E652DF0-B444-4F57-9628-62D17E63B4E8@microsoft.com...
> I'm trying to use a variable in a text string for the RecordSet.Find
command.
> My script looks something like this.
>
>
strKeyDiscerningCharacteristicData=objMDRDataDictionary.item("Compound")strS
earchCriteria = "Compound = '"& strKeyDiscerningCharacteristicData & "'""
> objRecordSet.Find strSearchCriteria
>
> When I run this, I get the error 'Microsoft VBScript compilation error:
> Unterminated string constant'. What's the correct way to set up the
string
> for the search criteria?
> TIA
> Ernie

It appears as though the only problem is that you have an extra double
quote on the end of the:

strSearchCriteria = "Compound = '"& strKeyDiscerningCharacteristicData &
"'""

line. Just delete the double quote from the end.



Re: Proper Syntax for Variable Name in RecordSet.Find by ebferro

ebferro
Fri Jun 24 14:53:02 CDT 2005

James:
Many Thanks. That did the trick.
Ernie

"James Whitlow" wrote:

> "ebferro" <ebferro@discussions.microsoft.com> wrote in message
> news:4E652DF0-B444-4F57-9628-62D17E63B4E8@microsoft.com...
> > I'm trying to use a variable in a text string for the RecordSet.Find
> command.
> > My script looks something like this.
> >
> >
> strKeyDiscerningCharacteristicData=objMDRDataDictionary.item("Compound")strS
> earchCriteria = "Compound = '"& strKeyDiscerningCharacteristicData & "'""
> > objRecordSet.Find strSearchCriteria
> >
> > When I run this, I get the error 'Microsoft VBScript compilation error:
> > Unterminated string constant'. What's the correct way to set up the
> string
> > for the search criteria?
> > TIA
> > Ernie
>
> It appears as though the only problem is that you have an extra double
> quote on the end of the:
>
> strSearchCriteria = "Compound = '"& strKeyDiscerningCharacteristicData &
> "'""
>
> line. Just delete the double quote from the end.
>
>
>