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

Changing font format based on value shown in specific field

44
Hello everybody,
I have a subform, say sbfrm1, with 2 fields, Field1 and Field2.
Field1 is a Yes/No field while Field2 has numeric values.
Some records in Field2 may show the same number.
When I click any record within Field1, it corresponds, in the same record but in Field2, to a specific numeric value.
Let us suppose, as an example, that I click, within Field1, the record ID7. It corresponds, in Field2 to the number 426.
What I need is that, following the above action, all records of sbfrm1 showing in Field2 the same number 426 could change their font format (light gray color and smaller font size).
I have been wondering if such a problem can be solved in access.
I was thinking of creating a variable, Var1, where the corresponding value (426 in the example) could be stored. Then, search, in sbfrm1, the records that in Field2 show the value stored in Var1 and change their font format. I don’t know, however, if this can be the right approach to the problem considering my rather poor level of expertise in access vba.
Any useful suggestions are very much welcome.
David.
Oct 23 '18 #1
5 1044
NeoPa
32,556 Expert Mod 16PB
Ah. Even more difficult than I originally thought. Now it's written out clearly in one place it's far easier to understand. BTW Well done for the explanation in English. Not very easy but you've done a pretty good job of being clear.

Now, I assume from this that you're looking for a way of highlighting certain groups of records - those where the numeric part of [Field2] matches a certain value? I also assume that when a separate record is clicked and updated then you want the first set to return to normal. Is that correct? It's not exactly what you said but it seems to make more sense.

This will need to be managed by using Conditional Formatting due to the reasons explained in Why Values in Unbound Form Controls do not Persist. All the Controls are defined once only and all the different values are essentially shown in the same Control.

Anyway, please answer my question above so that I/we can direct you in a more helpful way than simply answering the question (which might lead you to a solution that is less useful than others).
Oct 23 '18 #2
David57
44
Hi NeoPa,
Your assumption is quite correct. I just need to highlight certain groups of records, namely those where the numeric part of [Field2] matches the value corresponding in [Field2] when I click any record within [Field1].
One more example. If I happen to click , within [Field1], the record ID7. Well, since it corresponds to number 135 in [Field2], I need all records in sbfrm1 showing the number 135 in [Field2] to be highlighted by changing their font format.
The change in these records format must be permanent, that is I don’t need them to resume their original format whenever a separate record is clicked and updated.
David
Oct 23 '18 #3
twinnyfo
3,653 Expert Mod 2GB
David57,

Formats for fields are never changed permanently. They can only be displayed that way temporarily. This is because Table/Field formatting is at the Table level, not the Field. If you were to open a Table and click on any field or value and change the format to Bold, the entire Table would be changed to Bold.

If you are talking about changing the format of the field just while the form is open, that is another story. Then you would have to save all of these values for the fields in which you click and then cycle through any of those values to see if any fields match those values. Each time you would have to build that into a conditional formatting string that you would then apply to each the controls.

Hope this makes sense.

As NeoPa stated, much more complex than originally understood.
Oct 24 '18 #4
David57
44
Thank you Twinnyfo.
It really seems rather complex. I think it is much easier to select specific records rather than highlighting them.
Thanks to NeoPa, too.
David
Oct 24 '18 #5
NeoPa
32,556 Expert Mod 16PB
Let's be clear here. We're discussing the formatting of Controls - not Fields.

We're certainly looking at updating the Conditional Formatting of a Control, or even a set of them if all the controls need to be highlighted, to reflect whether any record with a matching numeric value has been flagged this way. This is made more complicated than necessary by having a single value stored, with other data, within a field. That is poor design. If it's important enough to check and have meaning on its own then it should be stored separately. Joining data together is far simpler than splitting apart atomic data.

It's not impossible, but would certainly require a lot of fiddling about in the Conditional Formatting data.

If it were stored in a more sensible way you could have a simpler query to return the list of values that determine which records to highlight, thus leaving the Conditional Formatting alone. As I say, possible, but far from straightforward. If it's important then it could be explored further but design changes would be recommended first.
Oct 24 '18 #6

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

Similar topics

4
by: Chuck | last post by:
I'm attempting to build a module that will allow me to update one field of a record (using a value from a previous record) based on the value of another field in the same record. I can...
2
by: John | last post by:
Hi Everyone, I have a question about dynamically changing the length of a varchar(n) field, in case the value I'm trying to insert is too big and will give a "truncated" error, but before the...
12
by: sjvandevoorde | last post by:
Hello- I need a little help. I don't think this is too difficult to do, however I have been away from any access development for some time and can't seem to figure it out. I've tried queries and...
3
by: mckbill | last post by:
Is there a way I can direct the cursor to a specific field (variable) in a form by typing the field name while in form view? I have a form with many fields, and it would be nice if there were...
5
by: theine | last post by:
How do I create Hyperlink based of a specific field in the same row? In Excel it done like this: =HYPERLINK("", A273) where the anything inside the " " is the value it's looking for in that...
0
by: doofy | last post by:
I need to be able to BOLD specific items in a combo box list. Not all will be bolded. I'm not finding any appropriate methods for the items. I'm wondering if I need to do something like make...
3
by: BobbyD1120 | last post by:
I have created a inventory tracking database and I want to show/hide certain fields based on the device category. The deviceCategory field is a lookup field to a table that lists all the different...
4
by: nedryerson | last post by:
Hi, I'm trying to get a certain field to appear only when a value from another combobox field is selected. Specifically, when "Sample Rejected" is selected in the field "PcrLabResults," I would...
1
by: sparrowfan | last post by:
i need some help please.I'm new to access,my question is how can i change the font colour for a yes/no field.Yes has to be in blue and no has to be in green in the same field. i know format is needed...
9
by: David57 | last post by:
Hello there! I’m coping with this problem I haven’t been able to solve so far. I have a subform, say sbfrm1. What I need is that whenever in sbfrm1 I click any record within a specific field, say...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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
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...

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.