paulmcdonnell
Ready to Help
- Local time
- Today, 22:44
- Joined
- Apr 11, 2001
- Messages
- 167
I have a record set on which I'm using code with Loop and EOF to through each record and change a boolean tag on or off.
This seems to work...
Dim dbs As Database
Dim rst As Recordset
Dim retvalue As String
On Error Resume Next
Set dbs = CurrentDb
Set rst = dbs.OpenRecordset(rsource)
rst.MoveFirst
Do While Not rst.EOF
With rst
.Edit
!selector = 0
.update
End With
rst.MoveNext
Loop
the rsource is a constructed SQL statement the procedure works when the SQL is simple like...
"SELECT Data_Basedata.*, Data_Basedata.company From Data_Basedata"
but when the sql become a bit more complex like...
"Select Data_Basedata.* From Data_Basedata WHERE (((Data_Basedata.Surname) Is Not Null) AND ((Data_Basedata.promssuppression)=[Forms]![Form-basedata-quick-update].[control2]))"
the loop never seems to end (the sql statements work through the QEB)
A bit stumped any ideas?
Cheers
Paul
This seems to work...
Dim dbs As Database
Dim rst As Recordset
Dim retvalue As String
On Error Resume Next
Set dbs = CurrentDb
Set rst = dbs.OpenRecordset(rsource)
rst.MoveFirst
Do While Not rst.EOF
With rst
.Edit
!selector = 0
.update
End With
rst.MoveNext
Loop
the rsource is a constructed SQL statement the procedure works when the SQL is simple like...
"SELECT Data_Basedata.*, Data_Basedata.company From Data_Basedata"
but when the sql become a bit more complex like...
"Select Data_Basedata.* From Data_Basedata WHERE (((Data_Basedata.Surname) Is Not Null) AND ((Data_Basedata.promssuppression)=[Forms]![Form-basedata-quick-update].[control2]))"
the loop never seems to end (the sql statements work through the QEB)
A bit stumped any ideas?
Cheers
Paul