I'm unable to use CInt() for a string -> number conversion, the number is 9 digits long, so I don't recall which conversion should be used. I've tried several, and none seem to work. can anyone help?
ok - I'm an idiot - the problem isn't actually with CInt() - I'm using CLng() and it works fine. The error is actually w/ comparing that value to the DB entry. The DB field is a Number field (access) when trying to compare, I get a Type mismatch error. I don't understand why.
I apologize for my original inaccurate post too by the way...
Dim iNumber = CLng(Request.Form("Number") Do Until objRS.EOF or bolFound If (objRS("Number") = iNumber) Then 'found it bolFound = True Else objRS.MoveNext End If Loop
That's basically the code. The error is at the red line
First can you Dim a variable and set it on the same line? Try changing the red line first. If that doesn't work, then try making the change indicated to the green line.
iNumber = CLng(Request.Form("Number") Do Until objRS.EOF or bolFound If CLng((objRS("Number")) = iNumber Then 'found it bolFound = True Else objRS.MoveNext End If Loop
Gosh...that's strange. Are the entries you're pulling from the database from a field that allows Nulls (that may be it)? Or is "Number" the actual name for the field? If so, try changing it to something else like "myNumber" (might have to do with a reserved word).