Results 1 to 2 of 2
  1. #1
    2 Star Lounger
    Join Date
    Oct 2007
    Posts
    172
    Thanks
    0
    Thanked 2 Times in 1 Post

    Unhappy MS Access - filter out records from a dataset based on values in a table

    Hi,

    I seem to have got myself into a bit of a pickle. I have a table "tblDocs" containing a list of document reference numbers and document types.

    Using VBA, I need to get the recordset from the tblDocs, but rather than filtering in records, I need to filter out all records with a document type which .

    Filtering in is ok, and I have..

    Code:
        Set qdf = CurrentDb.QueryDefs("qFilterDDLDocuments")
        qdf.Parameters("Filter") = typ 'filter in only those with this type
        Set rs = qdf.OpenRecordset
        If rs.RecordCount <> 0 Then
           rs.MoveLast
           GetNextAvailableID = CStr(rs.Fields("ID")) + 1
        Else
           GetNextAvailableID = 1
        End If
    but I need to change this to filter out all those records with a type equal to any document type which is listed in a table "tblUnwantedDocTypes". In other words, the only records I want in my recordset are those which do not have a document type equal those listed in the tblUnwantedDocTypes table.

    Please help!

    thanks
    Dom

  2. #2
    2 Star Lounger
    Join Date
    Oct 2007
    Posts
    172
    Thanks
    0
    Thanked 2 Times in 1 Post
    oh don't worry about it - I'm being a divvy I sorted it by just running a query to select those records with a type linked to the type in the other table.

    Silly me - it's been a decade since I wrote VBA for access!

Posting Permissions

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