Results 1 to 4 of 4
  1. #1
    bbrazeau is offline Competent Performer
    Windows 7 64bit Access 2007
    Join Date
    Sep 2011
    Posts
    101

    Filter Form with "CurrentRecord" property


    I have a form that pulls a lot of info from different tables together in a single record. There is no unique ID field I could set to match like in a typical filter. ie "CustomerID = " & CustomerID
    What I would like is to filter out all but the current record, then I'm going to use a DoCmd.RunSavedImportExport "MyExport" to save the record to a pdf for distribution.
    Does anyone know how to do this?? The following doesn't work.

    Dim sFilter As String
    Dim lngCurrRec as long
    lngCurrRec= Me.CurrentRecord
    sFilter = "[Me.CurrentRecord]= '" & lngCurrRec & "'"
    'assign the filter value,and turn filtering on
    Me.Filter = sFilter
    Me.FilterOn = True
    DoCmd.RunSavedImportExport "MyExport"
    Me.FilterOn = False

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,644
    There must be some unique criteria that can be applied, even if it is every field in the dataset, to isolate the record.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    bbrazeau is offline Competent Performer
    Windows 7 64bit Access 2007
    Join Date
    Sep 2011
    Posts
    101
    Hi June7, At present there is a way to uniquly identify the record with a 3 field criteria, but I was just looking for a simple means to do this that would work and continue to work as the database matures and potentialy develops the need for more complex criteria.
    As far as my question goes...Is there a way to filter the form to weed out all but the current record based solely on the record the user has currently navigated to. In other words leave it to the user to find the record they want then spit this record out as a pdf file?
    The reason I'm focusing on the "CurrentRecord" property is this seems as though it would be a perfect fit for what I'm trying to do.

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,644
    Not that I know of. Never used CurrentRecord property. Since your attempt to use it as filter criteria fails, I presume that is not valid use and filter criteria must be data.

    Do you want to output form or report to pdf?
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 3
    Last Post: 11-27-2012, 07:20 AM
  2. Form Filter "Missing Data" Using VBA
    By r0v3rT3N in forum Programming
    Replies: 12
    Last Post: 07-20-2012, 12:40 PM
  3. How do i fix "Property Value is too Large"
    By winterh in forum Access
    Replies: 2
    Last Post: 03-29-2012, 01:42 AM
  4. How to use "Filter" function on form
    By JackieEVSC in forum Forms
    Replies: 4
    Last Post: 11-05-2011, 01:12 AM
  5. Replies: 11
    Last Post: 11-26-2010, 10:53 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums