I am trying to make an SQL statement work. I have built it up by adding strings together. it all worked fine until I added an extra bit of code to find the first occurrrence of the string "No" in an array i use the code below to do this:
arrConfirmed = Array(strC1, strC2, strC3, strC4, strC5, strC6)
Dim iLoop, strPos, strNO
iLoop = "0"
strPos = "-1"
strNo = "No"
Do While strPos < 0
If (arrConfirmed(iLoop) = strNo) Then
strPos = iLoop
ElseIf (iLoop = UBound(arrConfirmed)) Then
strPos = (iLoop + 1)
Else
iLoop = iLoop + 1
End If
Loop
This works no problem but then I tried to add the value of strPos to my SQL statement with this code
strSQL = ("UPDATE tbl_sku_master SET stage = " + strStage)
strSQL = strSQL + (", earlystage = " + strPos)
strSQL = (strSQL + ", conf_" + strStage + " = 'Yes'"
strSQL = (strSQL + ", conf_by_" + strStage + " = " + "'" + strOwner + "'"
strSQL = (strSQL + ", conf_date_" + strStage + " = " + "'" + strNewDate + "'"
strSQL = (strSQL + " WHERE uniq_ref = " + strREF + ";"
this code works without the line that reads
"strSQL = strSQL + (", earlystage = " + strPos)"
all I get if it is included is "Type mismatch"
AAAaahhhhhhhhggggggggggg(signs of significant hair loss)
I have checked the database column settings for "earlystage" and they are "Number" "Long Integer" I am using Access 2000 databases.
Anyone got an idea of what I am doing wrong???(PLEASE)
I dont want to go to Chelsea!!!
arrConfirmed = Array(strC1, strC2, strC3, strC4, strC5, strC6)
Dim iLoop, strPos, strNO
iLoop = "0"
strPos = "-1"
strNo = "No"
Do While strPos < 0
If (arrConfirmed(iLoop) = strNo) Then
strPos = iLoop
ElseIf (iLoop = UBound(arrConfirmed)) Then
strPos = (iLoop + 1)
Else
iLoop = iLoop + 1
End If
Loop
This works no problem but then I tried to add the value of strPos to my SQL statement with this code
strSQL = ("UPDATE tbl_sku_master SET stage = " + strStage)
strSQL = strSQL + (", earlystage = " + strPos)
strSQL = (strSQL + ", conf_" + strStage + " = 'Yes'"
strSQL = (strSQL + ", conf_by_" + strStage + " = " + "'" + strOwner + "'"
strSQL = (strSQL + ", conf_date_" + strStage + " = " + "'" + strNewDate + "'"
strSQL = (strSQL + " WHERE uniq_ref = " + strREF + ";"
this code works without the line that reads
"strSQL = strSQL + (", earlystage = " + strPos)"
all I get if it is included is "Type mismatch"
AAAaahhhhhhhhggggggggggg(signs of significant hair loss)
I have checked the database column settings for "earlystage" and they are "Number" "Long Integer" I am using Access 2000 databases.
Anyone got an idea of what I am doing wrong???(PLEASE)
I dont want to go to Chelsea!!!