Hello,
I am having a heck of a time getting this to work. I am attempting to click the button, open the database and change existing information on the "Scrubbed RO's" table. I have tried many different ways and now am receiving the "Type Mismatch" error. Before, it would change data in the rows but it was not for the correct RO#.
Private Sub Command46_Click()
On Error GoTo Command46_Click_Err
Dim db As Database
Dim rs As DAO.Recordset
Set db = CurrentDb()
Set rs = db.OpenRecordset("Scrubbed ROs")
Count_of_RO = DCount("[RO #]", "Scrubbed ROs", "[RO #]='" & Me.RO_NUMBER & "'")
If Count_of_RO < 1 Then 'Check to see if record already exists
MsgBox "RO not Scrubbed. Use SCRUB RO Button"
Exit Sub
Else
With rs 'Add all record information from form
.Edit
.Fields("Scrub Code") = Me.ScrubCode
.Fields("Comments") = Me.ScrubComments
.Update
.Close
End With
If (MacroError <> 0) Then
Beep
MsgBox MacroError.Description, vbOKOnly, ""
End If
End If
MsgBox rs
DoCmd.Close
Command46_Click_Exit:
Exit Sub
Command46_Click_Err:
MsgBox Error$
Resume Command46_Click_Exit
End Sub
I am having a heck of a time getting this to work. I am attempting to click the button, open the database and change existing information on the "Scrubbed RO's" table. I have tried many different ways and now am receiving the "Type Mismatch" error. Before, it would change data in the rows but it was not for the correct RO#.
Private Sub Command46_Click()
On Error GoTo Command46_Click_Err
Dim db As Database
Dim rs As DAO.Recordset
Set db = CurrentDb()
Set rs = db.OpenRecordset("Scrubbed ROs")
Count_of_RO = DCount("[RO #]", "Scrubbed ROs", "[RO #]='" & Me.RO_NUMBER & "'")
If Count_of_RO < 1 Then 'Check to see if record already exists
MsgBox "RO not Scrubbed. Use SCRUB RO Button"
Exit Sub
Else
With rs 'Add all record information from form
.Edit
.Fields("Scrub Code") = Me.ScrubCode
.Fields("Comments") = Me.ScrubComments
.Update
.Close
End With
If (MacroError <> 0) Then
Beep
MsgBox MacroError.Description, vbOKOnly, ""
End If
End If
MsgBox rs
DoCmd.Close
Command46_Click_Exit:
Exit Sub
Command46_Click_Err:
MsgBox Error$
Resume Command46_Click_Exit
End Sub