G
Guest
I am using VBA to screen scrape values off of a Reflection Digital/Unix screen
(that isn't as difficult as it sounds)
into an Access Table. Part of this extract includes pieces of actual Cache'
code (MUMPS) which includes numerous quote charactes, apostrophes, pipe
characters etc...
What has become rather annoying is that I almost have this licked but every
once in awhile I run into a stumper.
There must be a sure fire way for VBA and SQL to just grab a string, no
matter how long or complex (length of less than 255 of course)
and just see it as a variable - in this case: sFmtOvr
the offending string that returned an error 3075 Syntax error in string in
query expression is this one:
"s %AIDataI(587)=$$ApptDt^AYKPHSCH($p(%AIM("SCH","SCH"), "|",5))
I'm figuring that it doesn't like the fact that there is an ODD number of
double quotes.
But here is a snippit of my code that has worked through numerous exposures
to these expressions:
I think the important line would be the last line: db.execute ....
where I try to write the value to a table.
lIndex = Val(.GetText(i, 37, i, 42))
' MsgBox "RowIndex: " & lIndex
If lIndex >= 1 Then LastGoodIndex = lIndex
If lIndex = 0 Then
' MsgBox "the index is less than 1"
sFmtOvr = sFmtOvr & Trim$(.GetText(i, 43, i, 125))
Else
sFmtOvr = .GetText(i, 43, i, 125)
sFmtOvr = Trim$(sFmtOvr)
End If
'take care of any offending apostrophe's
sFmtOvr = Replace(sFmtOvr, "'", "_APOSTROPHE_")
'msgbox "LastGoodIndex: " & LastGoodIndex
'msgbox "Write this override to index: " &
LastGoodIndex & " - " & sFmtOvr
If Len(sFmtOvr) > 1 Then
db.Execute "UPDATE tbl_AIC_LOC SET
[FormatOverride] = '" & sFmtOvr & "' WHERE [CustomizationRec] = '" & CustRec
& "' AND [Environment] = '" & glEnv & "' AND [AICIndx] = " & LastGoodIndex &
" AND ActualDateTime = #" & dtActualDate & "#;"
End If
Any help to assist licking this would be truly appreciated... Thanks!
(that isn't as difficult as it sounds)
into an Access Table. Part of this extract includes pieces of actual Cache'
code (MUMPS) which includes numerous quote charactes, apostrophes, pipe
characters etc...
What has become rather annoying is that I almost have this licked but every
once in awhile I run into a stumper.
There must be a sure fire way for VBA and SQL to just grab a string, no
matter how long or complex (length of less than 255 of course)
and just see it as a variable - in this case: sFmtOvr
the offending string that returned an error 3075 Syntax error in string in
query expression is this one:
"s %AIDataI(587)=$$ApptDt^AYKPHSCH($p(%AIM("SCH","SCH"), "|",5))
I'm figuring that it doesn't like the fact that there is an ODD number of
double quotes.
But here is a snippit of my code that has worked through numerous exposures
to these expressions:
I think the important line would be the last line: db.execute ....
where I try to write the value to a table.
lIndex = Val(.GetText(i, 37, i, 42))
' MsgBox "RowIndex: " & lIndex
If lIndex >= 1 Then LastGoodIndex = lIndex
If lIndex = 0 Then
' MsgBox "the index is less than 1"
sFmtOvr = sFmtOvr & Trim$(.GetText(i, 43, i, 125))
Else
sFmtOvr = .GetText(i, 43, i, 125)
sFmtOvr = Trim$(sFmtOvr)
End If
'take care of any offending apostrophe's
sFmtOvr = Replace(sFmtOvr, "'", "_APOSTROPHE_")
'msgbox "LastGoodIndex: " & LastGoodIndex
'msgbox "Write this override to index: " &
LastGoodIndex & " - " & sFmtOvr
If Len(sFmtOvr) > 1 Then
db.Execute "UPDATE tbl_AIC_LOC SET
[FormatOverride] = '" & sFmtOvr & "' WHERE [CustomizationRec] = '" & CustRec
& "' AND [Environment] = '" & glEnv & "' AND [AICIndx] = " & LastGoodIndex &
" AND ActualDateTime = #" & dtActualDate & "#;"
End If
Any help to assist licking this would be truly appreciated... Thanks!