Results 1 to 9 of 9
  1. #1
    Join Date
    Jan 2003
    Posts
    6

    Unanswered: Tagging records from a filtered recordset?

    I've created a yes/no "Tag" field in order to facilitate mail merging. I perform a number of different filters to select records. The idea is to tag just these filtered records for my mail merge query. I created a cmdTagAll to try to tag all filtered records simultaneously. However, when looping through my current recordset, ALL records in the open recordset get tagged, not just those in the resultset.

    Any ideas how I tag just those records in my filtered recordset so that I can then create my mail merge query? (I'm using MSAccess 2002).

    This one is really giving me a lot of grief.

    Thanks,

    Brian

  2. #2
    Join Date
    Jan 2003
    Location
    Aberdeen, Scotland, UK
    Posts
    168
    would it be possible (or easier?) to use an update query instead?
    J.

  3. #3
    Join Date
    Jan 2003
    Posts
    6

    Red face hmmm

    Originally posted by johncameron
    would it be possible (or easier?) to use an update query instead?
    I thought about this solution. The problem is that my filter conditions change, so I would have no consistent SQL statement to define a query. I though about somehow passing these filtered records to an update query, but I would again run into the problem of somehow tagging these filtered records to pass them into the update query. It's a Catch 22! Any ideas?

  4. #4
    Join Date
    Aug 2002
    Posts
    45
    if i understand correctly
    create a temp table with all the filtered recoreds in it.
    use an update query to update the records where they match the records in the temp table.
    delete the temp table
    is this what you want to do?
    Sent By Royal Mail

  5. #5
    Join Date
    Jan 2003
    Posts
    6
    that sounds like it would work, do you know how to do this?

  6. #6
    Join Date
    Aug 2002
    Posts
    45
    Originally posted by plastic101
    that sounds like it would work, do you know how to do this?
    sorry about the delay in replying and the briefness it's been a busy day

    you can create a temp table this way
    i dont know how you are creating the filtered set but you can put in each feild this way

    SELECT resultfeild1 AS tempFeildOne, tagfeild AS "tick" INTO temp .....etc

    and update

    UPDATE YourTable SET Feild1 = temp.tempfeildOne WHERE yourtableID = tempID .....etc

    delete
    docmd.DeleteObject acTable, temp

    if you are familiar with vb which i think you are from your first post you should be able too fill in the majority of the other code
    cq
    Sent By Royal Mail

  7. #7
    Join Date
    Jan 2003
    Posts
    6

    Smile

    thanks cq!

    i know just enough about vb to be dangerous, but i'll give it a shot!

    brian

  8. #8
    Join Date
    Jan 2003
    Posts
    6
    cq,

    my vb skills aren't as good as i'd hoped. when you get a chance, can you give me more of that code. i'm using access 2002, if that matters any.

    thanks - b

  9. #9
    Join Date
    Aug 2002
    Posts
    45
    sorry about the delay again
    i think itll go something like this

    Dim nameofdatabase AS DAO.Database, table AS DAO.Recordset,
    filter AS DAO.Recordset
    Set nameofdatabase = CurrentDb
    Set Filter = nameofdatabase.OpenRecordSet("nameofquery")
    ' you can use the combo on your form to specify the name of the filter i m guessing your using querys
    Set table = nameofdatabase.OpenRecordSet("Nameoftable", _ dbOpenTable)' table you want to update
    nameofdatabase.Execute_
    "Select etc;" ' make table temp nake sure all flters have the same column headings
    nameofdatabase.Execute_
    "Update etc;"
    docomd.deleteObjectactable, temp

    i hope this helps i havnt tested but it should put you on the right track
    cq
    Sent By Royal Mail

Posting Permissions

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