473,412 Members | 2,069 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,412 software developers and data experts.

MS Access: Show Image Based on Condition (Date Field)

Hello Everyone!

This is my first post to the forum.

---------------------------------------------------------------------------------------------

In my database, I have a continuous subform called: "subCallBack". I setup my query, so that it only shows records that do contain a date value, in the "lsrCallBackDate" column.

Any record within this subform, is one of our customers that our employee needs to call on a certain date. Even though each record is sorted (A~Z) by Call Back Date - I would like a visual indication telling the user which records require a call back today.

Image: "imgCallBackToday" [Visible: No]
Text Box: "txtCallBackDate"

If the Call Back Date of the record equals Today(), then I want the image to appear. If it does not match, then I want the image to stay invisible.

I would also like this image to be stored within a folder on the network where the Back End of my database is.

When I mention Today, I don't mean today as in: 04-26-06 - but Today() as in a rolling date. (Hope that makes sense...)

I have posted this question over at a paid forum I belong to, but none of the solutions that were provided to me worked correctly.

Thank you in advance for your help.

---------------------------------------------------------------------------------------------

Important Note:
When you respond to my question, please assume I know nothing about MS Access. My skill level, is a beginer & I tend to get lost very easily. :confused:
Apr 26 '06 #1
1 15164
CaptainD
135 100+
First off, is your form "bound" to the database? (By that I mean, do you click a "data control" to cycle through the records)

If so, I assume you have a text field that shows you the date in which the call back date is based on.

If that is the case then the following should get you started, it might be a little complicated at first till you get the general idea once you start.

In design mode for the form you should see a "Toolbox" on the left that has text boxes, labels etc. for designing the form. One of those controls is for images. Click on that and place it on your form where you want it. It will ask you where the image is you want to show in it. Navigate to the image located in the folder on your "Back end server".

Now, MS Access has a means to enter "VBA" code to do things you can not from the simple design mode. (Click "View" - "Code")

VBA code runs off "Events"

Clicking a button runs the Button_Click() event

When a Form loads it activates the Form_Load() event

When you change the records on the form with the data control it activates the Form_Current() event

Go into "View" "Code" and you will see two drop downs. Click the left drop down and select "Form" and it should put you in the form_Load event.

Now click to right "drop down" and select "Current" that will put you in the Form_Current() event.

In the form current event enter the following changing the text box name and image control names to yours.
Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_Current()
  2. On Error GoTo ErrHandler
  3.  
  4.     If txtDate.Text = Date Then
  5.         MyImage.Visible = True
  6.     Else
  7.         MyImage.Visible = False
  8.     End If
  9.  
  10. ErrHandler:
  11.     MsgBox "Error detected, error # " & Err.Number & ", " & Err.Description, vbOKOnly, "Error"
  12. End Sub
  13.  
Now run the form and cycle through the records and see what happens.
Apr 26 '06 #2

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

Similar topics

6
by: Steve Speirs | last post by:
Hi I'm trying to show/hide a simple piece of text and a text field on a form based on what choice is made from a drop down box. <select name="dropdown" size="1"> <option selected...
6
by: Yeah | last post by:
I have alternate holiday headers for my web site, and I would like to display a certain image for an upcoming holiday. Examples: Christmas 12/10 - 12/26 New Years Eve 12/27 - 1/2...
2
by: Shaiguy | last post by:
I have a table containing the following fields: ProjectUpdateID (PrimaryKey) ProjectID UpdateDate I would like to create a Query in Ms Access 2000 which will return me the most recent 2...
6
by: Greg | last post by:
I am trying to change the value of one field in my query based on the value in another. If Field 1 had the text "ONACCNT" then in Feild 2 I want the date to change to today's date. Any help would...
3
by: Fran Zablocki | last post by:
I have a process that exports an Access table to a comma-delimited text file. One of the fields that is exported shows the date it was exported, using the Date() function. In the Access table, the...
1
by: Graham Feeley | last post by:
I have a date field named rcdate it is a general date eg: 12/08/2006 3:30:00 PM 12/08/2006 3:00:00 PM I used to update another empty field named rdate with the with using in a update query "...
7
by: sheri | last post by:
I have a field called date, the date is in the field like this 70925 (which means Sept. 25, 2007). I have another field called day, it is a text field. How do I write a query to populate the day...
2
by: kashif73 | last post by:
Hi, I want to export data from 4 Access tables to Excel using VBA. The user selects 2 different DATES from the form & based on DATEs criteria all record from 4 tables should be extracted to...
2
by: slenish | last post by:
Hello, Im having an issue right now where im trying to link two tables in a query based on the date and then output the results to a report. What I have is a form set up to where you enter a...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

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.