Results 1 to 4 of 4
  1. #1
    angie is offline Competent Performer
    Windows 8 Access 2013
    Join Date
    Dec 2013
    Posts
    232

    query criteria to show on report header

    I have a report that is controlled by a query with a field name "employee on job" with the following criteria
    like "*" & [Select Option] & "*"


    which works great but I would like what ever selected option is selected will show in the report header.

    I have tried creating a unbound text box in the header and adding the follow =[report]![payroll] like "*" & [Select Option] & "*"
    there is no error but it shows a number and not the text.

    thanks Angie

  2. #2
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,397
    following on from your last thread - I suspect this is not possible since [Select Option] would appear to be a parameter prompting the user to enter a value.

    What you will need is a form where the user enters whatever the [Select Option] value is (might be a textbox, combobox or listbox) and a button which has some vba code to open the report and passes the value as a criteria - in which case the value can also be passed as an openarg.

    e.g. docmd.openreport "reportnamehere", , , "[fieldnamehere] like '*" & me.txtSelectOption & "*'", , me.txtSelectOption

    And then you would have some vba code in the report open event to populate your textbox header

    e.g.

    me.headertxtboxname=me.openargs

  3. #3
    ranman256's Avatar
    ranman256 is online now VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,521
    Don't make it unbound. Put the header in the query.
    Bind the header to the rpt field.

  4. #4
    angie is offline Competent Performer
    Windows 8 Access 2013
    Join Date
    Dec 2013
    Posts
    232
    Quote Originally Posted by ranman256 View Post
    Don't make it unbound. Put the header in the query.
    Bind the header to the rpt field.
    I put the following I the query. =[report]![payroll] like "*" & [Select Option] & "*"

    which returns a -1 not the name selected.

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

Similar Threads

  1. Replies: 1
    Last Post: 06-15-2016, 08:45 AM
  2. Show records with criteria - query
    By Lukael in forum Access
    Replies: 2
    Last Post: 01-22-2016, 03:56 AM
  3. Replies: 4
    Last Post: 10-13-2014, 02:18 AM
  4. Replies: 1
    Last Post: 04-06-2014, 10:58 AM
  5. Replies: 1
    Last Post: 06-12-2011, 07:08 AM

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