View Full Version : Very strange problem, please help.

10-10-2007, 10:38 PM
On an ASP page, the code below is throwing an error on the line "getAWvr = False". We originally assign this variable a value of True.
strSQL = "Select Fein From Emp_Hist Where Emp_Hist.SSN=" & da_ssn
strSQL = strSQL + " And Emp_Hist.Fein<>" & varFein
strSQL = strSQL + " And emp_hist.branch<>" & cInt(m_branch)
strSQL = strSQL + " And entry_date<>'" & Date & "'"

Set oRS = OConn.Execute(strSQL)
If Not oRS.EOF Then
GetAWvr = Flase
End If
I can't see anything wrong with it. I have tried changing the variable name, making it assign character and numberic data, but it keeps generating an error. If I take out the line, comment it out or change the If statement so it won't execute, no error is generated. What is going on? It looks like a perfectly good assignment statement to me.

Whatever Jr.
10-11-2007, 10:19 AM
It doens't say that on that line, it says GetAWvr = Flase.

HTH, Tom

10-11-2007, 03:00 PM
Thanks for the reply. That was a typo on my part. When I copied it in, I was trying to assign it as character ("N"), but I thought it would be easier to understand as logical so I changed it. Believe me, even when it says False it doesn't work.

I have also changed all references to GetAWvr to be character (GetAWvr = "N") and numeric (GetAWvr = 1). No matter what I assign to that variable at that place, it generates an error.

When I initialize it, it is fine, regardless of whether I set it to True, "N" or 0. But when I reassign it inside the If statement, it generates an error. Commenting out the line stops the error.

As a work around, if it is not EOF then I set up a loop and skip through the records I can accomplish what I need to do. But I can't understand why a simple assignment would generate an error here. I guess I could also look at the record count returned and it might work.

10-11-2007, 03:05 PM
whats the error your getting?

10-11-2007, 04:00 PM
All it says is "Syntax Error, Line 362". I can't get a good error message, the syntax looks good to me.

I have deleted the line and retyped it, just in case there was a hidden character in it. It didn't help.

I did reverse the logic, and moved the statement to an "Else" clause, it generated an error when it executed. Still, the assignment statement looks good. I checked the code, and the GetAWvr variable is only in 3 places, the original assignment, the reassignment where the error is generated, and an additional "If" statement later in the code to perform an action if it has been set.

I beginning to think any assignment statement I put in the If statement will generate an error. I can't see anything wrong with the assignment statement. It seems like every once-in-a-while, ASP just finds a line of code it doesn't like.

I am at another site today, so I can't work with it. Tomorrow I will try other assignment statements and move the offending statement to other places in the code to see how it works.

10-11-2007, 04:10 PM
hmm, I see.

well I've found that sometime if other code in the page is missing or has incorrect syntax, that the ASP engine will report the error as being on another different line,

try this, and see if it helps:

strSQL = "Select Fein From Emp_Hist Where SSN = '" & da_ssn & "' And Fein = '" & varFein & "' And branch = '" & cInt(m_branch) & "' And entry_date = '" & Date & "'"
Set oRS = OConn.Execute(strSQL)
If Not oRS.EOF Then
GetAWvr = false
End If

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum