Record Nav Problem RePost!!!

G

Guest

I am trying to navigate through records on a form w/a combo box.

I have this code running in the combo box.

Dim rs As Object

FilterOn = False
Set rs = Me.Recordset.Clone
rs.FindFirst "[CID] = " & Str(Me![cboCandNo])
Me.Bookmark = rs.Bookmark

cboCandNo is a list of all CID's

For example CID's 1-100

Any time your current record is CID 37, no matter what CID you select if it
is greater than 37, the form automatically reverts to CID 1 instead of the
selected CID. The code works fine for all other CID's.

Seems pretty weird to me.
Any Ideas?

TIA,
TimJ
 
A

Allen Browne

The code looks like the wizard-generated one, which tries to handle ADO and
DAO recordsets, doesn't bother checking NoMatch after the FindFirst, and is
subject to problems caused by the implicit save. For a more reliable
approach, see:
Using a Combo Box to Find Records
at:
http://allenbrowne.com/ser-03.html

We need to verify here that:
1) cboCandNo is *unbound*.
2) CID is a Number type field (not a Text type field.)

If all that checks out, and you still have the problem with just the one
record, you could have a corrupt index. Try a repair:
Tools | Database Utilities | Compact And Repair

If it's still stuck you could rebuild the table by following the
instructions for the 2nd symptom in:
Recovering from corruption
at:
http://allenbrowne.com/ser-47.html
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top