R
Richard Horne
Hi guys,
I have designed a telephone call log database and have a tabbed menu system
with 10 pages each containg code on the on timer event to make them requery
every 1 minute, this works in the main but every now and then I get an error
message saying Field 'Tel ID' cannot be found.
Can anyone see anything wrong with the following code:
Private Sub Form_Timer()
Dim rst As DAO.Recordset
Dim lngID As Long
Dim CurCtl As String
If IsNull(Me.[Tel ID]) = True Then
Exit Sub
Else
CurCtl = Me.ActiveControl.Name
lngID = [Tel ID]
Me.Requery
Set rst = Me.RecordsetClone
rst.FindFirst "[Tel ID] = " & lngID
If Not rst.NoMatch Then
Me.Bookmark = rst.Bookmark
DoCmd.GoToControl CurCtl
Me.ActiveControl.SetFocus
End If
rst.Close
Set rst = Nothing
End If
End Sub
I have double checked all my sub forms and [Tel ID] is correctly named and
positioned on every form - this error message only seems to occur
intermittently and I'm not exactly sure what's causing it.
Can anyone help?
The system can sometimes go 2+ hours before the message appears but it does
keep coming back and it's very puzzling.
I have designed a telephone call log database and have a tabbed menu system
with 10 pages each containg code on the on timer event to make them requery
every 1 minute, this works in the main but every now and then I get an error
message saying Field 'Tel ID' cannot be found.
Can anyone see anything wrong with the following code:
Private Sub Form_Timer()
Dim rst As DAO.Recordset
Dim lngID As Long
Dim CurCtl As String
If IsNull(Me.[Tel ID]) = True Then
Exit Sub
Else
CurCtl = Me.ActiveControl.Name
lngID = [Tel ID]
Me.Requery
Set rst = Me.RecordsetClone
rst.FindFirst "[Tel ID] = " & lngID
If Not rst.NoMatch Then
Me.Bookmark = rst.Bookmark
DoCmd.GoToControl CurCtl
Me.ActiveControl.SetFocus
End If
rst.Close
Set rst = Nothing
End If
End Sub
I have double checked all my sub forms and [Tel ID] is correctly named and
positioned on every form - this error message only seems to occur
intermittently and I'm not exactly sure what's causing it.
Can anyone help?
The system can sometimes go 2+ hours before the message appears but it does
keep coming back and it's very puzzling.