lbowers
asked on
DAO 3.6 & "Item not found in this collecion"...
I'm updating my applications to use Access 2000 databases using VB6 SP3's DAO 3.6.
Whenever I do a <data control>.Refresh and the data control's recordset is empty, I'm getting an "Item not found in collection" error. The very same piece of code used to work with DAO 3.51! Anyone know what's wrong and how to solve it?
Whenever I do a <data control>.Refresh and the data control's recordset is empty, I'm getting an "Item not found in collection" error. The very same piece of code used to work with DAO 3.51! Anyone know what's wrong and how to solve it?
Does the error happen on the Refresh line, or on a subsequent line where you try to access one of the columns of the recordset? If so, then try something like:
....
Data1.Refresh
If Data1.Recordset.Bof or Data1.Recordset.EOF then Exit sub
' or try
' if Data1.Recordset.Recordcoun t < 1 then Exit Sub
txtName.text = Data1.Recordset("EmpName") & ""
....
Data1.Refresh
If Data1.Recordset.Bof or Data1.Recordset.EOF then Exit sub
' or try
' if Data1.Recordset.Recordcoun
txtName.text = Data1.Recordset("EmpName")
ASKER
Yes - It does happen on the refresh line.
Too much of the code hangs of the Dat Control, so removing that isn't an option sadly...
Is there any other solution?
Thanks.
Too much of the code hangs of the Dat Control, so removing that isn't an option sadly...
Is there any other solution?
Thanks.
ASKER
I've also tried using the .RecordCount < 1 method and it only works *sometimes*!
Weird eh?
Weird eh?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Someone posted the exact problem i think yestersday.
I think it is a problem with the Data control and the new version of dao that is causiong the error. Unless Microsoft has brought out a pathc or an updated control you might have to go with out the data control and create recordset using sql and populate your fields or db grids.
Sorry this is not very helpfull but like i said earlier this seems to be quite a problem now with Access 2000,
Maybe post the question in the Access topic area , someone might be able to help u there.
:0)
Craig