I have a form that is used to set a database backup timer.
When I execute the Image32_click the form "frmTimer" opens fine, but the table "tblBUDirTime" field "TimetoBackUp" does not update. If I close the form "frmTimer" and execute the Image32_click again the table updates?
Im hoping someone here can see my mistake?
Cheers,
Code:
Private Sub Image32_Click()
On Error Resume Next
Dim db As DAO.Database
Dim rs As DAO.Recordset
Set db = CurrentDb
Set rs = db.OpenRecordset("tblBUDirTime")
If Not IsNull(Me!txtTime) Or Not Me!txtTime = "" Then
rs.MoveFirst
If Not rs.BOF Then
rs.Edit
Else
rs.AddNew
End If
rs("TimetoBackUp") = CDate(Me!txtTime)
rs.Update
Else
MsgBox "You have not selected a back up time to add", vbCritical + vbOKOnly, "StraightEdge Software"
Me!txtTime.SetFocus
rs.Close
db.Close
Set rs = Nothing
Set db = Nothing
Exit Sub
End If
rs.Close
db.Close
Set rs = Nothing
Set db = Nothing
MsgBox "Backup time saved successfully.", vbInformation, "StraightEdge Software"
DoCmd.OpenForm "frmtimer"
Set db = CurrentDb
Set rs = db.OpenRecordset("tblBUDirTime")
If Not IsNull(Me!txtTime) Or Not Me!txtTime = "" Then
rs.MoveFirst
If Not rs.BOF Then
rs.Edit
Else
rs.AddNew
End If
rs("TimetoBackUp") = CDate(Me!txtTime)
rs.Update
Else
MsgBox "You have not selected a back up time to add", vbCritical + vbOKOnly, "StraightEdge Software"
Me!txtTime.SetFocus
rs.Close
db.Close
Set rs = Nothing
Set db = Nothing
Exit Sub
End If
rs.Close
db.Close
Set rs = Nothing
Set db = Nothing
MsgBox "Remember to Leave open the Backup Timer", vbCritical + vbOKOnly, "StraightEdge Software"
DoCmd.OpenForm "frmsetup", , , , , acHidden
DoCmd.OpenForm "FRMTIMER"
Me.Requery
End Sub
When I execute the Image32_click the form "frmTimer" opens fine, but the table "tblBUDirTime" field "TimetoBackUp" does not update. If I close the form "frmTimer" and execute the Image32_click again the table updates?
Im hoping someone here can see my mistake?
Cheers,