Results 1 to 6 of 6
  1. #1
    RemoteRobot is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Jun 2015
    Location
    Indiana, USA
    Posts
    4

    Cool Setting an Objects printing characteristics

    I am currently working on a project that requires an object (image) formatted on a report to either print or not print whenever a check box is selected on a form. I believe that it can be done through VB and the set property function, but I am not that familiar with the process.



    Can anyone provide direction or assistance?

  2. #2
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,862
    You can use Booleans within a table to determine the status of something. In other words, you can create a field of type Yes/No in your table. The value of the field will reflect the status of your "something".

    Reports have a Filter property that can be used when the report is rendered. For instance, you can apply a filter to not include records where your Boolean = False.

    There are other approaches too.

  3. #3
    RemoteRobot is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Jun 2015
    Location
    Indiana, USA
    Posts
    4
    Thanks,
    I do not want to exclude records as I am limiting the report based on the active view of the form. What I am attempting to do is to limit a field on the report based on whether it is selected on the form with a checkbox.

  4. #4
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,862
    Sometimes it is not easy to get the results you desire. It depends on data structure and how your report is built. However ...

    You can place code in the Report's On Format event handler. The difficult part is determining where, within the report, your control resides. The control you want to hide may be in the footer or it may be in the detail section, etc.

    Once you determine which section the control resides in, you can create a Sub Procedure for that section. While in design view, you can click the section to select it. Then, view the property sheet. In the Event tab, there will be an On Format event. You can create a new Sub Procedure for the event by clicking the corresponding ellipses (...) and, then, selecting the "Code Builder" option.

    Here is an illustration of the detail section for a report. You would want to select something similar in your report.
    .
    Click image for larger version. 

Name:	FormDetailSection.jpg 
Views:	6 
Size:	23.8 KB 
ID:	20952

    Then you want to place some code in your new sub procedure, just before the termination line (End Sub).

    Something like

    If Me.ControlName.Value = -1 then 'The value of the field is yes
    Me.ControlName.visible = True
    Else 'The value of the field is No
    Me.ControlName.visible = False
    end if

  5. #5
    RemoteRobot is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Jun 2015
    Location
    Indiana, USA
    Posts
    4
    If I could create a logic it would look something like this:

    =IIf([Forms]![frmlData]![CheckF]="Yes",[Image24].[DisplayWhen]="Print Only",[Image24].[DisplayWhen]="Screen Only")

    This would be required for 9 different images on the report which will also have corresponding check boxes.

    Does that make sense?

  6. #6
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,862
    Quote Originally Posted by RemoteRobot View Post
    ...This would be required for 9 different images on the report which will also have corresponding check boxes....
    I would start with one image. Maybe this behind the report ...

    If Forms!frmlData![CheckF].Value = -1 then 'The value of the control is yes
    Me.Image24.Value = "Print Only"
    Else 'The value of the control is No
    Me.Image24.Value = "Screen Only"
    end if

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

Similar Threads

  1. Replies: 1
    Last Post: 06-19-2014, 08:35 PM
  2. OLE Objects
    By BrianF in forum Import/Export Data
    Replies: 3
    Last Post: 04-26-2013, 04:11 PM
  3. OLE Objects in forms
    By snowboarder234 in forum Forms
    Replies: 2
    Last Post: 10-31-2012, 01:48 PM
  4. Replies: 2
    Last Post: 09-29-2011, 12:50 PM
  5. Setting Printer when Printing Report
    By russ0670 in forum Reports
    Replies: 3
    Last Post: 05-12-2010, 09:45 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