M
Marwan
Are there any known issues with the RecordSet property on listboxes?
It's displaying rather strange behaviour in my application.
I'm building a form that has three relevant elements:
1. A list box
2. A 'modify' button that causes the rowsource on the listbox to be
changed
3. A 'search' button that references the recordset on the list box
(and using clone, findfirst, etc.)
The wierd behaviour is this:
If I open the form and click 'search', it works
If I open the form and click 'modify', then 'search', it works
If I open the form and click 'search', then 'modify', then 'search', I
get an error such as "Object invalid or not set" when attempting any
operation on the listbox's recordset
If you want to try it out yourself, you can set up as follows:
Create two tables we'll call TableA and TableB. Create a form that has
a listbox called lst with TableA as its rowsource. Add two buttons
called cmdSearch and cmdModify. The two buttons have the following
code:
Private Sub cmdSearch_Click()
Dim rst As DAO.Recordset
Set rst = lst.Recordset.Clone
rst.FindFirst "1=0"
End Sub
Private Sub cmdModify_Click()
lst.RowSource = "TableB"
End Sub
Now if you click 'search', then 'modify', then 'search', you should
get an error at the FindFirst line.
Hints? Tips? Mindless Accusations?
Appreciated,
Marv
It's displaying rather strange behaviour in my application.
I'm building a form that has three relevant elements:
1. A list box
2. A 'modify' button that causes the rowsource on the listbox to be
changed
3. A 'search' button that references the recordset on the list box
(and using clone, findfirst, etc.)
The wierd behaviour is this:
If I open the form and click 'search', it works
If I open the form and click 'modify', then 'search', it works
If I open the form and click 'search', then 'modify', then 'search', I
get an error such as "Object invalid or not set" when attempting any
operation on the listbox's recordset
If you want to try it out yourself, you can set up as follows:
Create two tables we'll call TableA and TableB. Create a form that has
a listbox called lst with TableA as its rowsource. Add two buttons
called cmdSearch and cmdModify. The two buttons have the following
code:
Private Sub cmdSearch_Click()
Dim rst As DAO.Recordset
Set rst = lst.Recordset.Clone
rst.FindFirst "1=0"
End Sub
Private Sub cmdModify_Click()
lst.RowSource = "TableB"
End Sub
Now if you click 'search', then 'modify', then 'search', you should
get an error at the FindFirst line.
Hints? Tips? Mindless Accusations?
Appreciated,
Marv