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)
End If

MsgBox " Fault Changed! "


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:

05-29-2002, 03:43 PM
You need to move rs!Fault_Fixed = True to just before your rs.Update

05-30-2002, 05:34 AM
I have tried your suggestion, but it still won't change the value in the database

05-30-2002, 07:14 AM
What is this line, cn.Execute (sqlnumber), supposed to be doing?
How are you deciding that the value is updated?

05-30-2002, 08:25 AM
Oh... heh... he doesn't even have a recordset to update does he. :)

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum