bob_g
05-29-2002, 03:39 PM
Can anyone find anything wrong with this code:
Public Sub Change_Fault()
Dim cn As ADODB.Connection
Dim rs As ADODB.Recordset
Dim strCnn As String
Dim strFaultID As String
Dim path As String
Dim strFirstName As String
Dim strLastName As String
Dim booRecordAdded As Boolean
' Open a connection.
Set cn = New ADODB.Connection
path = "dbFault.mdb"
strCnn = "Provider=Microsoft.Jet.OLEDB.4.0;Persist Security Info=false;"
strCnn = strCnn & "Data Source=" & path & ";"
cn.Open strCnn
' Open Fault table.
Set rs = New ADODB.Recordset
rs.CursorType = adOpenKeyset
rs.LockType = adLockOptimistic
rs.Open "Fault", cn, , , adCmdTable
strFaultID = Trim(InputBox("Please enter the Fault ID number " & _
"that has been fixed:"))
sqlnumber = "select * from Fault where FaultID = " & strFaultID & " "
rs!Fault_Fixed = True
' Show contents of buffer and get user input.
strMessage = "Confirm Fault " & strFaultID & " has been fixed ? "
If MsgBox(strMessage, vbYesNo) = vbYes Then
cn.Execute (sqlnumber)
rs.Update
Else
rs.CancelUpdate
End If
MsgBox " Fault Changed! "
rs.Close
cn.Close
When the program runs, I get no error message, but it isn't changing the value in the 'Fault_Fixed' column from false to true
Anyone any suggestions??? :confused:
Public Sub Change_Fault()
Dim cn As ADODB.Connection
Dim rs As ADODB.Recordset
Dim strCnn As String
Dim strFaultID As String
Dim path As String
Dim strFirstName As String
Dim strLastName As String
Dim booRecordAdded As Boolean
' Open a connection.
Set cn = New ADODB.Connection
path = "dbFault.mdb"
strCnn = "Provider=Microsoft.Jet.OLEDB.4.0;Persist Security Info=false;"
strCnn = strCnn & "Data Source=" & path & ";"
cn.Open strCnn
' Open Fault table.
Set rs = New ADODB.Recordset
rs.CursorType = adOpenKeyset
rs.LockType = adLockOptimistic
rs.Open "Fault", cn, , , adCmdTable
strFaultID = Trim(InputBox("Please enter the Fault ID number " & _
"that has been fixed:"))
sqlnumber = "select * from Fault where FaultID = " & strFaultID & " "
rs!Fault_Fixed = True
' Show contents of buffer and get user input.
strMessage = "Confirm Fault " & strFaultID & " has been fixed ? "
If MsgBox(strMessage, vbYesNo) = vbYes Then
cn.Execute (sqlnumber)
rs.Update
Else
rs.CancelUpdate
End If
MsgBox " Fault Changed! "
rs.Close
cn.Close
When the program runs, I get no error message, but it isn't changing the value in the 'Fault_Fixed' column from false to true
Anyone any suggestions??? :confused: