paulmcdonnell
Ready to Help
- Local time
- Today, 11:21
- Joined
- Apr 11, 2001
- Messages
- 167
Hi guys,
I have a continuous form full of columns of data. I created a filter for this form which when applied sets the recordsource of the form to some sql statement.
If the user chooses to 'tag' those in the selection for later data processing I have a selector field which is boolean. A control which when clicked loops through records in the sql statement and sets the seletor of the chosen recordset to -1
Problem I'm having is that process works for a basic sql statement but when there is any condition in the sql statement the loop continues indefinately and no records are changed.
My code looks like this
Dim dbs As Database
Dim rst As Recordset
Set dbs = CurrentDb
Set rst = dbs.OpenRecordset(rsource)
rst.MoveFirst
Do While Not rst.EOF
With rst
.Edit
!selector = -1
.update
End With
rst.MoveNext
Loop
Me.Requery
End
Where rsource is the variable string which the sql is contructed into.
The sql in the string is valid and works , I checked it with QEB.
SO I'm not sure why this code doesn't work where a valid sql statement is the variable..
Any ideas
Hopefully
Paul
I have a continuous form full of columns of data. I created a filter for this form which when applied sets the recordsource of the form to some sql statement.
If the user chooses to 'tag' those in the selection for later data processing I have a selector field which is boolean. A control which when clicked loops through records in the sql statement and sets the seletor of the chosen recordset to -1
Problem I'm having is that process works for a basic sql statement but when there is any condition in the sql statement the loop continues indefinately and no records are changed.
My code looks like this
Dim dbs As Database
Dim rst As Recordset
Set dbs = CurrentDb
Set rst = dbs.OpenRecordset(rsource)
rst.MoveFirst
Do While Not rst.EOF
With rst
.Edit
!selector = -1
.update
End With
rst.MoveNext
Loop
Me.Requery
End
Where rsource is the variable string which the sql is contructed into.
The sql in the string is valid and works , I checked it with QEB.
SO I'm not sure why this code doesn't work where a valid sql statement is the variable..
Any ideas
Hopefully
Paul