473,387 Members | 1,549 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,387 software developers and data experts.

Continuous forms having different properities for each record

I'm trying to apply a conditional formatting property to one field of my continuous form. I want the date field to go red if the date listed is more than 3 months old. I've managed to write some code for this but I can't get the code to be applied to individual records. The code works but only once an individual record has been selected, and it then applies the change in colour to EVERY record on the form. Is there a way that I can get the dates to turn red as the form is opened without having to select each individual record, therefore highlighting to the user which records they need to pay attention to?

Thanks for any help.

Rachel
Aug 1 '10 #1

✓ answered by parodux

Insert this expression on your conditional formatting:

Expand|Select|Wrap|Line Numbers
  1. DateDiff("m";[YourDateField];Date())>3
  2.  

8 5498
beacon
579 512MB
Hi Rachel,

Welcome to Bytes!

You should be able to put the code in the Form_Load event. Can you post the code you've written so far?
Aug 1 '10 #2
parodux
26
Insert this expression on your conditional formatting:

Expand|Select|Wrap|Line Numbers
  1. DateDiff("m";[YourDateField];Date())>3
  2.  
Aug 1 '10 #3
Thanks for such quick replies!

This is the code I'm using;


If Date - [PerDateReqInfo] > 90 Then
[PerDateReqInfo].ForeColor = vbRed
Else
[PerDateReqInfo].ForeColor = vbBlack
End If

If I put this on 'On Load Form' it makes every date field in the form Red. I've tried to put it on 'On Current' and this works to a certain extent. It changes the colour from Red to Black but the user has to select each record to make this change happen. I want the form to load and the records over 3 months to already be red, thus drawing attention to them.

I'm hoping this is possible, but my knowledge of VBA is, oh about 1 week old!!

Thanks for any help.

Rachel
Aug 1 '10 #4
beacon
579 512MB
After re-reading your post, I think parodux's suggestion would probably serve you best. I overlooked the part about you not wanting to have to touch each record. There may be a way to loop through the controls to get the formatting to work, but it's probably more hassle than it's worth.

I think you should use the Conditional Formatting option under the Format menu. Enter your expression, or parodux's expression, and it should work the way you want.
Aug 1 '10 #5
I'm really sorry, I know I'm being dense!! But I can't find the Conditional Formatting option, it is within the Access Properities within design view? Should I be looking under the 'form' properties or the actual field properities?

Sorry!
Aug 1 '10 #6
parodux
26
Sorry I was just elsewhere... Right click on the field in design view!~)
Aug 2 '10 #7
missinglinq
3,532 Expert 2GB
As was finally suggested, this kind of thing can only be done, in a Continuous View or Datasheet View Form, thru Conditional Formatting from the Format Menu! Trying to do this in code, regardless of the event used, will, as you've found out, format the field in all records, based on the value in the field in the current record!

The only type of formatting, thru code, that can be done with these kinds of forms involves the Locked or Locked/Enabled Properties.

Using CF thru coding, when it can be done, in a Single View form, or in Datasheet or Continuous View form, as noted in the previous paragraph, has to be done using the Form_Current Event.

Linq ;0)>
Aug 2 '10 #8
Thank you, I got it to work in the end!

Rachel
Aug 2 '10 #9

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

Similar topics

2
by: aaj | last post by:
Hi all I have a small but rather annoying problem with continuos forms, and am wondering if anyone can suggest a method of getting over it. The front end is Access 2002 with the BE being SQL...
2
by: Cro | last post by:
Dear Access Developers, I am developing a form with 'default view' set to "continuous forms". I am suffering with a problem I can't yet see a solution too. Each record has many fields. Two...
2
by: crcucb | last post by:
I know Access struggels with having a different look in each record in a continuous form. I am looking to work with a list of data and have some records indented, to designate they belong under...
5
by: Armando | last post by:
I recently saw the tail end of a "Continuous forms" discussion, but not enough was available to see if this will be a PITA repeat question. Sorry if it is. On a form with its Default View...
3
by: Hans Karman | last post by:
Is it possible to set the background colour for each record in a continuous form to the colour stored in a datafield within that record? Hans Karman, Canberra, Australia
3
by: Richard Hollenbeck | last post by:
I have the following query in my form's code: Private Function Get_Data(fieldNum As Integer) Dim strSQL As String Dim db As DAO.Database Dim rs As DAO.Recordset strSQL = "SELECT & "", "" & ...
9
by: Edwinah63 | last post by:
Hi everyone, Please let there be someone out there who can help. I have two BOUND combo boxes on a continuous form, the second being dependent on the first. I have no problem getting the...
3
by: RAG2007 | last post by:
I have a subform that is set in continuous form view. My VBA code fills in specific values in unbound fields on each form in the "On Current" event. The values are dependent on other fields in the...
5
by: kenethlevine | last post by:
Hello I am fairly new to Access and am having a problem for which I am trying everything without success. It is access 2003. I have a main form. When the user presses a button a modal popup...
24
by: NaftoliGug | last post by:
Is there a way to have unbound, uncalculated controls (or a calculated control that is based on a function) that retains a different value for each record?
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

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.