G
GLT
Hi,
I am trying to loop through an unbound subform, test it's three records with
the main forms three records, and if there is a match, then NOT execute the
SQL.
Is there a way to write this loop more effeciently? I am old school with
loops (for-next etc) - what would be the best loops to acheive this?
'Search in the clone set of the subform
Set rs = Me.subfrmPermSrvcsIgnore.Form.RecordsetClone
skip = 0
Do While Not rs.EOF
test1 = rs![Type]
test2 = rs![Server]
test3 = rs![Service Name]
If test1 = Me![fldSelShutType] Then
If test2 = Me![fldSelServer] Then
If test3 = Me![fldSelService] Then
MsgBox "This service is alreay in the ignore table under
the 'ALL' catagory - no update made"
skip = 1
End If
End If
End If
rs.MoveNext
Loop
'Set rs = Nothing
If skip = 0 Then
CurrentDb.Execute strSQL, dbFailOnError
Else
skip = 0
End If
I am trying to loop through an unbound subform, test it's three records with
the main forms three records, and if there is a match, then NOT execute the
SQL.
Is there a way to write this loop more effeciently? I am old school with
loops (for-next etc) - what would be the best loops to acheive this?
'Search in the clone set of the subform
Set rs = Me.subfrmPermSrvcsIgnore.Form.RecordsetClone
skip = 0
Do While Not rs.EOF
test1 = rs![Type]
test2 = rs![Server]
test3 = rs![Service Name]
If test1 = Me![fldSelShutType] Then
If test2 = Me![fldSelServer] Then
If test3 = Me![fldSelService] Then
MsgBox "This service is alreay in the ignore table under
the 'ALL' catagory - no update made"
skip = 1
End If
End If
End If
rs.MoveNext
Loop
'Set rs = Nothing
If skip = 0 Then
CurrentDb.Execute strSQL, dbFailOnError
Else
skip = 0
End If