Hi,
Can anyone please help me with my command button.
What it's suppose to do is if vbYes is chosen, then it will update a Field (fieldname "Approved") = True.
If vbNo then the updates will be deleted.
This command Save button is in a form which calls on a data table called TblCover to update the field.
When I run this code, it gives me the error "RUNTIME ERROR 91 - object variable or with block variable not set" amd it highlights the line " .Open ..."
Can anyone please help me?
==============================================
Private Sub cmdSave_Click()
Response = MsgBox("Has this been Signed and Approved?", vbYesNo + vbCritical)
If Response = vbYes Then
Set ActiveConnection = TblCover
With rst
.Open "TblCover", cnn, adOpenDynamic, adLockOptimistic
.Fields("Approved").Value = True
.Update
DoCmd.Save acForm, "Cover"
End With
End If
If Response = vbNo Then
strText = MsgBox("You need to get Manager signature and Approval", vbCritical)
With rst
.Delete (adAffectCurrent)
.Close
End With
Set myRecordset = Nothing
Set conn = Nothing
End If
End Sub