Failure of logic due to quotation marks?

max1

Registered User.
Local time
Tomorrow, 01:23
Joined
Jun 17, 2014
Messages
30
Hi,

In the highlighted line of code attached I am comparing two strings one from a snapshot recordset and one from an array.

The logic fails, you can see in the watches window both values equal "DESIGN and the elseif statement should execute but it does not.

The only reason I can see for this is that the values are equal to "DESIGN and not DESIGN. Where this single quotation mark comes from I do not know. It is not visible in the tables and it does not appear when the values are printed into excel.

all comments are much appreciated
 

Attachments

  • Capture.JPG
    Capture.JPG
    78.2 KB · Views: 75
Hello max1, Welcome to AWF :)

Try Stepping through or maybe debug using pop up message boxes. It might be able to clear things much easier.
 
Are you able to provide us with an error message?

Maybe this?
rst1(#).Value = "DESIGN"
 
Hi,

No error message, the elseif statement simply does not execute when I want it to!

Check out the previously attached screenshot with the active watches. Maybe it is to do with the data type, the array is a string, the recordset is object/field2?

The highlighted line of code (elseif) in the screenshot should be the next to execute but it does not, the next line to execute is the else statement.
 
figured it out, field size was 255 so I was comparing "DESIGN" with "DESIGN ....255 spaces..."
 

Users who are viewing this thread

Back
Top Bottom