Results 1 to 4 of 4
  1. #1
    Mike4172 is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jul 2012
    Posts
    17

    VBA Code Help for Report

    I have a query set up with all information I Need but need to filter it for a report.

    What I want to do is grab the current drivers liscense number being shown in access and pull all the records under that number.



    Something to effect of "If DLnumber = match, pull each record in query where dl matches". One drivers liscense number could have several records in query. Any help I'd appreciate it.

  2. #2
    help_me_with_access is offline help_me_with_excel
    Windows XP Access 2007
    Join Date
    Jun 2012
    Posts
    262
    Mike,

    either base the rpt on a query that takes a paramater....or filter the report and refresh it with:

    Code:
    1)
    me.filter = "[field] = '" & inputVal & "'" (for strings)
    me.filter = "[field] = " & inputVal (for numerics)
    
    2)
    me.filteron = true
    
    3)me.refresh
    refresh, requery, or you may not even need to do either of those. I just remember those methods annoying me everytime I had to deal with them.

  3. #3
    Mike4172 is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jul 2012
    Posts
    17
    Hmmm looking thru others examples would something like this work?

    DoCmd.OpenReport "rptDLs", acViewPreview, , "DL_ID = " & DL_ID

  4. #4
    help_me_with_access is offline help_me_with_excel
    Windows XP Access 2007
    Join Date
    Jun 2012
    Posts
    262
    yes, that would probably work too.

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

Similar Threads

  1. Run code for every record in report
    By CamtheChamp in forum Reports
    Replies: 4
    Last Post: 05-21-2012, 01:33 PM
  2. vba code required for report
    By princeofdumph in forum Programming
    Replies: 1
    Last Post: 12-09-2011, 08:49 AM
  3. Problem in report and used code...
    By manos39 in forum Reports
    Replies: 12
    Last Post: 11-23-2011, 05:24 PM
  4. SQL Code to Make Query / Report
    By agent- in forum Programming
    Replies: 10
    Last Post: 06-17-2011, 04:14 PM
  5. code to print just first page of a report
    By tonyrice in forum Reports
    Replies: 1
    Last Post: 02-14-2007, 03:07 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