I have this code to update my DB records:
ElseIf Len(Request.Form("cmdUpdate") > 0 Then
'Update record
If Request.Form("chkFloppy" = "on" Then
strFloppy = "yes"
Else
strFloppy = "no"
End If
If Request.Form("chkNIC" = "on" Then
strNIC = "yes"
Else
strNIC = "no"
End If
If Request.Form("chkCDRom" = "on" Then
strCD = "yes"
Else
strCD = "no"
End If
If Request.Form("chkBurner" = "on" Then
strBurner = "yes"
Else
strBurner = "no"
End If
If Request.Form("chkModem" = "on" Then
strModem = "yes"
Else
strModem = "no"
End If
strSQL = "UPDATE tblComputers SET Status='" & Request.Form("cboStatus" & "', Department='" & Request.Form("txtDept" & _
"', Cube='" & Request.Form("txtCube" & "', FirstName='" & Request.Form("txtFirstName" & "', LastName='" & Request.Form("txtLastName" & _
"', CarePak='" & Request.Form("txtCarePak" & "', Vendor='" & Request.Form("cboVendor" & "', Model='" & Request.Form("txtModel" & _
"', Processor='" & Request.Form("txtProc" & "', ClockSpeed=" & Request.Form("txtSpeed" & ", BIOS='" & Request.Form("txtBIOS" & _
"', RAM=" & Request.Form("txtRAM" & ", HardDrive=" & Request.Form("txtHD" & ", VideoCard='" & Request.Form("txtVideo" & "', Modem='" & strModem & _
"', VideoCardMemory=" & Request.Form("txtVidMem" & ", MouseManufacturer='" & Request.Form("txtMouse" & "', Hub='" & Request.Form("txtHub" & "', Port='" & Request.Form("txtPort" & _
"', IPAddress='" & Request.Form("txtIP" & "', HostName='" & Request.Form("cboHostName" & "', OperatingSystem='" & Request.Form("cboOS" & _
"', OfficeApplication='" & Request.Form("cboOffApp" & "', PurchaseDate='" & Request.Form("txtPurchDate" & "', PurchasePrice='" & Request.Form("txtPurchPrice" & _
"', Notes='" & Request.Form("txtNotes" & "' WHERE SerialNumber='" & Request.Form("txtSerialNum" & "'"
strDSN = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\INetPub\ Response.Write strSQL 'Debugging to check SQL syntax
Set Conn = Server.CreateObject("ADODB.Connection"
Conn.Open strDSN
Conn.Execute strSQL,numRecords,1
If numRecords > 0 Then
Response.Write "<H1>Record Updated</H1>"
Else
Response.Write "<H1>Error Updating Record</H1>"
End If
Conn.Close
Set Conn = Nothing
The little section is blue is a "Yes/No" data field in my Access 2000 database. If I take the check boxes part out it updates the record, as soon as I put it back in it tells me SYNTAX error in SQL statement. Anyone have any work arounds for this?
ElseIf Len(Request.Form("cmdUpdate") > 0 Then
'Update record
If Request.Form("chkFloppy" = "on" Then
strFloppy = "yes"
Else
strFloppy = "no"
End If
If Request.Form("chkNIC" = "on" Then
strNIC = "yes"
Else
strNIC = "no"
End If
If Request.Form("chkCDRom" = "on" Then
strCD = "yes"
Else
strCD = "no"
End If
If Request.Form("chkBurner" = "on" Then
strBurner = "yes"
Else
strBurner = "no"
End If
If Request.Form("chkModem" = "on" Then
strModem = "yes"
Else
strModem = "no"
End If
strSQL = "UPDATE tblComputers SET Status='" & Request.Form("cboStatus" & "', Department='" & Request.Form("txtDept" & _
"', Cube='" & Request.Form("txtCube" & "', FirstName='" & Request.Form("txtFirstName" & "', LastName='" & Request.Form("txtLastName" & _
"', CarePak='" & Request.Form("txtCarePak" & "', Vendor='" & Request.Form("cboVendor" & "', Model='" & Request.Form("txtModel" & _
"', Processor='" & Request.Form("txtProc" & "', ClockSpeed=" & Request.Form("txtSpeed" & ", BIOS='" & Request.Form("txtBIOS" & _
"', RAM=" & Request.Form("txtRAM" & ", HardDrive=" & Request.Form("txtHD" & ", VideoCard='" & Request.Form("txtVideo" & "', Modem='" & strModem & _
"', VideoCardMemory=" & Request.Form("txtVidMem" & ", MouseManufacturer='" & Request.Form("txtMouse" & "', Hub='" & Request.Form("txtHub" & "', Port='" & Request.Form("txtPort" & _
"', IPAddress='" & Request.Form("txtIP" & "', HostName='" & Request.Form("cboHostName" & "', OperatingSystem='" & Request.Form("cboOS" & _
"', OfficeApplication='" & Request.Form("cboOffApp" & "', PurchaseDate='" & Request.Form("txtPurchDate" & "', PurchasePrice='" & Request.Form("txtPurchPrice" & _
"', Notes='" & Request.Form("txtNotes" & "' WHERE SerialNumber='" & Request.Form("txtSerialNum" & "'"
strDSN = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\INetPub\ Response.Write strSQL 'Debugging to check SQL syntax
Set Conn = Server.CreateObject("ADODB.Connection"
Conn.Open strDSN
Conn.Execute strSQL,numRecords,1
If numRecords > 0 Then
Response.Write "<H1>Record Updated</H1>"
Else
Response.Write "<H1>Error Updating Record</H1>"
End If
Conn.Close
Set Conn = Nothing
The little section is blue is a "Yes/No" data field in my Access 2000 database. If I take the check boxes part out it updates the record, as soon as I put it back in it tells me SYNTAX error in SQL statement. Anyone have any work arounds for this?