Hello everybody,
i am an access beginner and was surfing the hole day for a solution for my problem, but i can't get it..
With this vb-code i want to check wheter an i have an entry in a query (qryConnSampleTS) or not. if yes --> checkbox = true...
i dont want to check for each recordset manually therefore i put it under a current_event and at the end of the code a docmd.gotorecord acnext...
put it gives me an error 2105 (after 125-128 entries). i can stop the error msg with "on error resume next" but the acnext stops again after the same amount of entries...
here my code...
Thanks a lot!
David
Private Sub Form_Current()
Me.thinSectionC = False
Me.thinSectionUC = False
Dim db As DAO.Database
Dim rsTS As DAO.Recordset
Dim strSQLTS As String
Dim var
Set db = CurrentDb
strSQLTS = "SELECT sampleNr,covered FROM qryConnSampleTS"
Set rsTS = db.OpenRecordset(strSQLTS)
If Not rsTS.EOF Then rsTS.MoveFirst
Do While Not rsTS.EOF
var = rsTS!sampleNr
varString = CStr(var)
If Me.sampleNr = varString Then
If rsTS!covered = True Then
Me.thinSectionC = True
Else
Me.thinSectionUC = True
End If
End If
rsTS.MoveNext
Loop
rsTS.Close
Set rsTS = Nothing
strSQLTS = ""
'Set db = Nothing
If Me.CurrentRecord < Me.Recordset.RecordCount Then
On Error Resume Next
DoCmd.GoToRecord , , acNext
End If
Set db = Nothing
End Sub
i am an access beginner and was surfing the hole day for a solution for my problem, but i can't get it..
With this vb-code i want to check wheter an i have an entry in a query (qryConnSampleTS) or not. if yes --> checkbox = true...
i dont want to check for each recordset manually therefore i put it under a current_event and at the end of the code a docmd.gotorecord acnext...
put it gives me an error 2105 (after 125-128 entries). i can stop the error msg with "on error resume next" but the acnext stops again after the same amount of entries...
here my code...
Thanks a lot!
David
Private Sub Form_Current()
Me.thinSectionC = False
Me.thinSectionUC = False
Dim db As DAO.Database
Dim rsTS As DAO.Recordset
Dim strSQLTS As String
Dim var
Set db = CurrentDb
strSQLTS = "SELECT sampleNr,covered FROM qryConnSampleTS"
Set rsTS = db.OpenRecordset(strSQLTS)
If Not rsTS.EOF Then rsTS.MoveFirst
Do While Not rsTS.EOF
var = rsTS!sampleNr
varString = CStr(var)
If Me.sampleNr = varString Then
If rsTS!covered = True Then
Me.thinSectionC = True
Else
Me.thinSectionUC = True
End If
End If
rsTS.MoveNext
Loop
rsTS.Close
Set rsTS = Nothing
strSQLTS = ""
'Set db = Nothing
If Me.CurrentRecord < Me.Recordset.RecordCount Then
On Error Resume Next
DoCmd.GoToRecord , , acNext
End If
Set db = Nothing
End Sub