473,725 Members | 2,017 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Change colour of box within record of continuous form...

50 New Member
Hi guys,

I have a continuous form and one field is Day / Night, where a 'D' or 'N' is contained to represent each.

Is it possible to write code for the 'on current' of the form to ensure a box contained within the specific record is one colour for those records with 'D' and another for those with 'N'?

I used for...each...ne xt statement from the help and adapted it to suit my form, but it changed the colour of ALL of the boxes depending on which record was highlighted???

Hope you can help, OllyJ
Jan 29 '08 #1
9 7128
sierra7
446 Recognized Expert Contributor
Hi again Olly
Have you tried 'Conditional Formatting' ? Highlight the control in design mode then click Format > Conditional Formatting. .

You will need Access 2000+. A young lady on this forum gave me the hint a few weeks ago but I haven't tried it yet.

I had previously done this using overlaid boxes which is OK to change colour of text within a box but not so for Background or Border, so the above method looks better.

Best of luck

S7
Jan 29 '08 #2
NeoPa
32,569 Recognized Expert Moderator MVP
I explained this to someone the other day too.
Essentially Conditional Formatting is the route you need.

What you need to remember is that a control on a continuous form is simply the one control. When you make changes to the design, it's not to any specific instance of the control, but to the control itself.

There are reasons for this which you can think through if you consider how it would handle these if it were obliged to support the items separately. It would need to maintain an array of undefined size. Getting messy already.
Jan 29 '08 #3
OllyJ
50 New Member
Thanks for your help so far guys...

I have applied conditional formatting to the textbox and the colours changed as desired. However, despite setting the properties of the textbox to enabled=false and locked=true, when running the form and clicking the mouse on the textbox it allows a text cursor to be placed inside... although it won't let you edit the text, it still causes a problem as it blocks out all of the textboxes in front of it.

Its as if when conditional formatting applies, it resets its default properties.

I have tried code 'on current' of the form to ensure that it stays enabled=false but this doesn't work...

Any ideas??

Hope you can help, OllyJ
Jan 30 '08 #4
sierra7
446 Recognized Expert Contributor
Interesting . . .

I can't picture exactly what is going wrong for you (i.e. why the cursor in the box is a bad thing) but I understand that it should not be allowed there anyway.

I have not got first hand experience of this so will leave it to NeoPa . .

Until then I am guessing that Access is 'adding' overlaid boxes which are not picking-up the attributes you have set for your original text-box.


S7
Jan 30 '08 #5
NeoPa
32,569 Recognized Expert Moderator MVP
I think you're trying to hide the TextBoxes conditionally. I'm afraid this is not supported. (Let me know if I have the wrong end of the stick here.)
Jan 31 '08 #6
OllyJ
50 New Member
Sorry, probably my explanation, i'll have another go...

I have successfully implemented a method which allows me to highlight the current record within a continuous form when it is selected.

*** My problem is that the user needs to be able to click anywhere on any record to highlight it (make current), as I have all controls disabled (so they cannot be edited nor the cursor shown), it doesn't allow me to do this?
It does allow me if i have a control enabled but then auto' highlights the text of the control that is enabled (which is what i'm trying to avoid.) To reiterate... I could do with ALL controls and fields within my continuous form disabled but allow the user to highlight the current selected record without using the record selectors etc (just a click of the mouse anywhere on that record)

*** Also, prior to clicking the required record, I need for the mouseover event to be coded so that which ever record the mouse is over is highlighted. I have entered code for this 'onmousemove' but it highlights all records as soon as you move the mouse over one (being a continuous form). Any ideas??

Very specific requirements I know, I just have to deliver as many as possible!!

Many thanks in advance, OllyJ
Jan 31 '08 #7
sierra7
446 Recognized Expert Contributor
Hi Olly

First problem first! It sounds like the built in Conditional Formatting will not do for you, so you will have to rely on the overlaid box technique.

Lets say you just want to change the colour of the text to start with. Lets say the field you want to display is called 'Field1' (I've exhausted my inventivness today) and you want the text to be Blue when Field1 =N and Red when Field1 = D

So, take you original box and copy then past it (so it should retain the same size) Now select one box and change the ForeColor to Red, and change the Control Source data
Expand|Select|Wrap|Line Numbers
  1.  =IIf([Field1]="D",[Field1],"")
Now select the second box and change its ForeColor to Blue, Set the Control Source to ;
Expand|Select|Wrap|Line Numbers
  1.  =IIf([Field1]="N",[Field1],"")
Oh, I did not say that the Background of these boxes should be Transparent, now if you set their Top values the same they should align and when you run the form you should get the effect you want.

As they are both transparent you should see your highlight bar through them. You may have to bring them to the 'front' (Format > Bring to Front)

I haven't found a way to change the Border colour but you can mess with the background by creating two more boxes, setting their ForeColour as required and using similar code, but instead of displaying the field name you display a series of block-box characters.

=IIf([Field1]="D","█████","" )

These two boxes must obviously be set behind the text boxes!

If you use background colours for boxes then this will mess with the continuity of your highlight bar.

I think you have no hope with MouseOver in a continous form but I'll try something and get back.

S7

PS
The display in the forum has inserted "font=Arial " and "/font" in the above but these are not part of the code!

PPS
Then I took them out ;) -NeoPa.
Jan 31 '08 #8
NeoPa
32,569 Recognized Expert Moderator MVP
I think an inherent problem with your requirements Olly, are that they must either be relative to the continuous items themselves (impossible as they are all instances of the one simple item), or they are relative to the basic form (making the task of overlaying very tricky to say the least).
Jan 31 '08 #9
sierra7
446 Recognized Expert Contributor
Hi again Olly

I think there is very little chance of using OnMouseMove to move the highligt bar in a continuous form.

My highlight bars move by knowing which is the current record, then highlighting it. This means that the records can be scrolled with the mouse wheel then the user selects the required record by clicking. Alternatively, the up/down arrow keys or tab keys move between records so the highlight moves, to show the current record.

I imagine you could pick-up the co-ordinates of the mouse and draw a 'free-floating' highlight bar to match but what good would that do? If you take the mouse out of the continuous form, what is the highlight bar to do then?
S7
Jan 31 '08 #10

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

Similar topics

3
4764
by: Peter Williams | last post by:
Hi All, I want to write some javascript for a html page which does the following. Imagine that the page contains a table with 2 columns and 3 rows, e.g.: +---+---+ | A | B | +---+---+
3
2358
by: Hans Karman | last post by:
Is there any way in which I can have the background colour of one or more records set to the colour stored in a datafield within the record? Hans Karman, Canberra, Australia
3
4142
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
4
2645
by: vidiot | last post by:
I am trying to create a subform that will display images related to the parent form. The subform is a continuous form as there will be several images that relate to the parent form. I checked Access help and it gave me the following code, which I have adapted for my database and it works well as a SINGLE FORM. Option Compare Database Private Sub Form_Current()
3
3931
by: ApexData | last post by:
I am using a continuous form for display purposes. Above this form, a single record is displayed so that when the user presses my NewButton they can enter a NewRecord which gets added to the continuous form that displays below. Under the NewButton I have these lines of code: Me.AllowAdditions = True DoCmd.GoToRecord , , acNewRec
10
37317
by: webgirl | last post by:
Hi there, I've been searching the net & the forums here over the last few days for help with my problem & am getting myself really confused.. hoping someone may be able to help me here. I've got a continuous form which has 6 textboxes in each row, one of which contains the name of an Assessor, who (in another table) will have a particular colour assigned for him/her. What I'm trying to do is loop through the records of the continuous...
2
2931
by: aldeb | last post by:
My dilemma is as follows. I have a continous form that I am using as a Visual Display Form to show the status of records (SoeCodes). What their status currently is and what they have been. I have 6 Yes/No check boxes (status). I am wanting to change color depending on which of the 6 check boxes is checked and I want to leave each checkbox checked. My form is a continuous form and since I need 6-7 colors Conditional Formatting will not work. I...
15
28906
by: OllyJ | last post by:
Hi guys, probably a basic question but have been struggling for some time so thought i'd see if you could help. I have a main schedule table which contains the fields... Date; Machine; Arm/Head; Job Number; Stock Code; Operator; QtyPred; QtyAct My ideal form would be a continuous one (so I can easily search through a selection of dates eg. 01/12/2008 - 09/12/2007) but need to have only one record per date. *** My problem is that the table...
2
5074
by: OllyJ | last post by:
Hi guys hope you can help... ...do you have any idea how you can set a control's (within a single record in a continuous form) property to visible=false depending on the outcome of an update within the same record. i.e. I have a work category combo box within a subcontinuous form... when you update the category to 'absent', I want to make the 'Job Number' control in that record invisible as it is no longer relevant... i don't however want...
0
8888
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8752
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9257
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9174
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8096
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6702
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6011
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4782
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2157
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.