Results 1 to 6 of 6
  1. #1
    Join Date
    May 2004
    Posts
    1

    Unanswered: how to query a certain record that is being modified lately?

    i am currently having a problem on getting a query that does the following:

    - i have a certain products actively involved in circulation and transaction....
    - what i need is to query the products by the latest date of circulation/ transaction and to bring it out in a query or report regardless whether the last transaction date is today or the a day few years ago for different products....

    please help...thank you

  2. #2
    Join Date
    Mar 2004
    Posts
    118
    Well the easiest way would be to edit the table you are quering to add a new field which would record when that record was last modified.

    Alternatively you could run a form in the background that would make a record when records are modified, but thats much more cumbersome.

  3. #3
    Join Date
    Mar 2003
    Location
    The Bottom of The Barrel
    Posts
    6,102
    Provided Answers: 1
    I'm onboard with YevSnow. Create a LastModified field with a default value of date().
    oh yeah... documentation... I have heard of that.

    *** What Do You Want In The MS Access Forum? ***

  4. #4
    Join Date
    Apr 2004
    Location
    outside the rim
    Posts
    1,011
    I concur.

    Have a little table with the PartKey and Date.

    Each time a record is modified, use:
    Code:
    DoCmd.SetWarnings False
    DoCmd.RunSQL("INSERT INTO tblTrack ( PartKey ) SELECT " & intKey & " AS PartKey;")
    DoCmd.SetWarnings True
    The RunSQL will be faster than using recordsets and the "SetWarnings" will disable the "You're about to add 1 record ..." popup.

    Have fun.

  5. #5
    Join Date
    Dec 2003
    Location
    Dallas, TX
    Posts
    1,004
    Quote Originally Posted by tcace
    I concur.

    Have a little table with the PartKey and Date.

    Each time a record is modified, use:
    Code:
    DoCmd.SetWarnings False
    DoCmd.RunSQL("INSERT INTO tblTrack ( PartKey ) SELECT " & intKey & " AS PartKey;")
    DoCmd.SetWarnings True
    The RunSQL will be faster than using recordsets and the "SetWarnings" will disable the "You're about to add 1 record ..." popup.

    Have fun.
    Just a Note on the SetWarnings thing too...Be Careful Though not critical it can cause problems if you don't remember to SetWarnings back to TRUE. What I did to avoid that was to use CurrentDB.Execute which I put when running an UpdateQuery. Works fine and nothing to remember to reset. Just a tip from what I have learned.

    Bud

  6. #6
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    Hi

    Just a note of agreement with Bud, and to expand a little. If you do use setwarnings then make sure you handle errors (e.g. on error resume next or set warnings to true in your error handler). If you suddenly find your form changes being saved without you being warned about it you know setwarnings is set to false.
    Also, depending on what you want, you can use:

    currentdb.execute strSQL, dbFailonError

    This means that you aren't asked if you want to insert rows but will get a message if there is a failure
    Testimonial:
    pootle flump
    ur codings are working excelent.

Posting Permissions

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