473,320 Members | 1,694 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

How to make image on report visible using yes/no field as criteria

I have an image on my report that I want to make visible only when a yes/no field is true. The yes/no field is a hidden text box called txtTried. The code I've been trying to use is:
Expand|Select|Wrap|Line Numbers
  1. If Me!txtTried = True Then
  2.     Me.imgBerry.Visible = True
  3. Else: Me.imgBerry.Visible = False
  4. End If
I got this to work on a form by using the same code in the Form_Current event, but it won't work in my report. Have tried it in the Report_Current, Report_Activate, Report_Load, Report_Open, and Detail_Format events, nothing happens in any of those except the Report_Open one gives an error saying can't find the field, control, or property, and in debug mode the first line of code is highlighted.
Not sure if I'm making sense, can anyone help me with this?
Oct 5 '10 #1

✓ answered by ADezii

  1. The [Tried] Field in the underlying Data Source should be a Yes/No Field represented by a Check Box, and not a Text Box.
  2. Change the Control Name to chkTried in the Detail Section of your Report.
  3. Place the following, single line of Code, in the Format() Event of the report's detail Section.
    Expand|Select|Wrap|Line Numbers
    1. Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
    2.   Me![imgBerry].Visible = Me![chkTried]
    3. End Sub

4 9743
ADezii
8,834 Expert 8TB
  1. The [Tried] Field in the underlying Data Source should be a Yes/No Field represented by a Check Box, and not a Text Box.
  2. Change the Control Name to chkTried in the Detail Section of your Report.
  3. Place the following, single line of Code, in the Format() Event of the report's detail Section.
    Expand|Select|Wrap|Line Numbers
    1. Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
    2.   Me![imgBerry].Visible = Me![chkTried]
    3. End Sub
Oct 5 '10 #2
NeoPa
32,556 Expert Mod 16PB
From your question it's not clear if the Yes/No control you refer to (as a field) is on the form still, or has been duplicated to the report to match a field in the record source. If the former, then you will have problems referencing the control. We could help with that if more info were available. If the latter then ADezii's post should solve your problem. The control should certainly be a CheckBox and not a TextBox, and the code he provided is preferable to yours, which should work fundamentally, but is overly complicated for the task. If so, you may choose to mark his post as the best answer.
Oct 5 '10 #3
Yes I did have the yes/no field on the report as well, so changing it to a checkbox and changing the code did get it all working. If only experience with code-writing was something that could be gotten quicker!
Thank you both so much for your help :)
Oct 5 '10 #4
NeoPa
32,556 Expert Mod 16PB
It's a pleasure, and especially so when members display such good manners :-)
Oct 6 '10 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: Erwin | last post by:
At the moment I'm using a report which contains an indicator to show if a Service group of the company isn't working well or is working perfectly. This indicator is a "*" which looks like a traffic...
1
by: spamfurnace | last post by:
Hi There. I have a panel that i display to the user after they have entered some data. On that panel is a label which is set to visible = false at design time. If i make the panel visible however...
6
by: Patrick Olurotimi Ige | last post by:
I have a Datalist in a form with a hyperlink i would like to make the hyperlink visible only when a checkbox is clicked and not visible when not clicked . But doing this below in page_load it...
0
by: Vikramaditya Singh | last post by:
i have made a crystal repoirt using field defination methos (.ttx). Now i am passing a dataset to it at runtime but no records is beiing displayes this is the code i am using to creating dataset...
1
by: ZinksInk | last post by:
How do I make a report display the current record open in a form? This seems like it should be a simple issue however I am strugling to figure out what code SQL / Querry I should use to do this....
0
by: oren18 | last post by:
hello.does anybody know .. how to make an image database by using VB.NET 2005 and Microsoft Access i want to make an application ( VB.NET 2005 ) that prompt a user to put his picture into...
1
by: vinic | last post by:
This seems like it would be a straightforward function, but after searching all morning I'm a bit stuck. Into an exsiting db, I'd like to update a field (called "week") in rows with certain dates...
6
by: Sajeena | last post by:
<?php // starting word $text = "My Text"; //Start MS Word $Word = new COM("word.application") or die("Failure: Word did not start"); echo("WORD has started."); //Formating the Font...
1
by: eko99312 | last post by:
I made a report concept from a simple query that contain as follow SELECT ., .Reason FROM GROUP BY ., .Reason HAVING (((.)>= And (.)<=) AND ((.Reason) Is Not Null)); When I click the view...
1
anoble1
by: anoble1 | last post by:
I am trying to make a report that compares one database to another. Maybe I can make some sense out of this. I am trying to make a query, that actually opens the other database in the background...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.