Results 1 to 4 of 4
  1. #1
    Join Date
    Apr 2006
    Posts
    157

    Question Unanswered: Find A 'previous' Record

    i'm currently using the me.currentrecord to tag a previous record,
    so I can return to it after I do an add operation , or anytime I move away from the current record


    is there any other simple and efficient way that I can handle this,
    it doesn't work as well when filter/delete operations occur,
    -the number of records change and the current record pointer moves with it.

    by the way, is there any way to retrieve the number of records on the current record filter?

    many thanks,

    syntaxerror
    Only quitters quit!

  2. #2
    Join Date
    Nov 2002
    Location
    Sydney, Australia
    Posts
    11
    At the module level, declare a variable to hold the current and prev record's key fields, eg "Last_ID" and "Current_ID".

    In the form's Update event, assign the value of the key field to Current_ID.

    In the OnCurrent event (when you move to another record), assign the record's key field to Last_ID.

    Now, if Last_ID <> Current_ID, you'll know you've moved records, plus have the prev record's ID.

    To get a count of records after filtering, try using myForm.RecordsetClone.RecordCount.

    HTH
    Max Hugen
    Hugen Enterprises Pty Ltd
    www.hugen.com.au
    Australia

  3. #3
    Join Date
    Nov 2002
    Location
    Sydney, Australia
    Posts
    11

    Talking

    Oops, my last post wouldn't work... if you don't edit the current form the OnUpdate event won't fire of course!

    Just use the OnCurrent event, with the two module level variables, something like:
    Last_ID=Current_ID
    Current_ID=me!myKeyField


    Cheers
    Max Hugen
    Hugen Enterprises Pty Ltd
    www.hugen.com.au
    Australia

  4. #4
    Join Date
    Apr 2006
    Posts
    157
    thanks

    I'll try this, perhaps a bit later, but for now I have to present the project ...


    syntaxerror
    Only quitters quit!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •