Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6911653
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T08:59:06+00:00 2026-05-27T08:59:06+00:00

Is there something wrong with the following code (in an ADP form) ? Private

  • 0

Is there something wrong with the following code (in an ADP form) ?

Private Sub cmbSearchCode_AfterUpdate()
  Me.Recordset.Find "usr_cde = '" & ctl & "'"`
  ctl = null
end sub

It behaves erratically: the first times after opening the form, it works, then suddenly it does not seem to do anything anymore.

I replaced it by this code that seems to have no problems:

With Me.RecordsetClone
    .Find "usr_cde = '" & ctl & "'"
    Me.Bookmark = .Bookmark
End With
ctl = Null

Any explanation ?
The client is A2003, the server is SS 2000 (I know it’s old, nothing I can do about it !)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T08:59:06+00:00Added an answer on May 27, 2026 at 8:59 am

    The Form.Recordset Property is a fairly new addition to access, there are a couple of bits in the helptexts, it’s how they combine that I believe is causing your issue.

    If a form is based on a query, for example, referring to the
    Recordset property is the equivalent of cloning a Recordset object by
    using the same query. However, unlike using the RecordsetClone
    property, changing which record is current in the recordset returned
    by the form’s Recordset property also sets the current record of the
    form.

    So while it doesn’t look like it at first, it does actually clone the recordset and create a new copy of it. Just it keeps it synchronised.

    So you have a new Recordset Object and here’s the rub:

    A new Recordset object is automatically added to the Recordsets
    collection when you open the object, and is automatically removed when
    you close it.

    First time round, you clone the recordset find on usr_cde, and the form magically sets the current record to match.

    Second time round, you clone the recordset find on usr_cde, but the magical record synchronisation is still stuck on the first copy of the recordset that has been persisted in the Recordsets collection.

    So you just need to close the recordset, but to make sure you don’t just create another copy and close that do the following:

    'untested
    Private Sub cmbSearchCode_AfterUpdate() 
      Dim rs as adodb.Recordset
    
      Set rs = Me.Recordset
      rs.Find "usr_cde = '" & ctl & "'"`
      rs.Close
    
      ctl = null
    end sub
    

    I haven’t had a chance to test this, but you already have a working solution using .Bookmark. I hope this explains the unexpected behaviour.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

There's something wrong with my code or I'm just not understanding this fully. I
I have translated the following code using ternary. However, I knew there was something
Are methods calls really so slow or is there something wrong in my computer?
There is something wrong with this trigger. But what? CREATE TRIGGER MYCOOLTRIGGER AFTER INSERT
I wonder if there is something wrong with the copy constructor function below? class
I've got the following code: class the_class { private the_field; function the_class() { the_field
What's wrong with the following code? for (var x=0;x<8;x++){ for (var y=0;y<8;y++){ table[y][x]=new Peon(black,x,y,table);
I'm trying to use the following code to log users in: $(form).submit(function(event) { $.ajax({
I cant use the following code in Master page for Globalization & Localization. It
Is there something like the Python descriptor protocol implemented in other languages? It seems

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.