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

Change fontwieght of a field during On format event

I can't seem to be able to access the font weight property of a field.

What I am doing is during the on format event of my form, If my key field is not blank or null then i want to make the whole record bold

If Me!SupplierID <> "" And Not IsNull(Me!SupplierID) then
'Make all fields in this record bold
end if


I have tried :
Me!SupplierID.FontWieght = "Bold"
Me!SupplierID = Format(Me!SupplierID, "Bold")

I have 8 fields in my record set so I would need to do this for each one

I also tried to create a control type variable and loop through all controls in acdetail

I would appreciate any input very much

Thanks
Jul 27 '07 #1
4 5530
damonreid
114 Expert 100+
Try this, it works for me.

Expand|Select|Wrap|Line Numbers
  1. Me.Fieldname.FontBold = True
Jul 27 '07 #2
missinglinq
3,532 Expert 2GB
Your post is a little confusing, as you speak of a Form and the OnFormat event. There is no OnFormat event for a Form, only for a Report!

Assuming that you are speaking of a form, damonreid's suggestion is valid. It needs to be placed in the Form_Current event, and rather than set each textbox control to bold, you can simply loop thru all textboxes like this:
Expand|Select|Wrap|Line Numbers
  1.  Private Sub Form_Current()
  2. For Each ctrl In Me.Controls
  3.   If TypeOf ctrl Is TextBox Then
  4.     If Not IsNull(Me!SupplierID) Then
  5.       ctrl.FontBold =True
  6.     Else
  7.       ctrl.FontBold = False
  8.     End If
  9.   End If
  10.   Next
  11. End Sub
Note that this will only work on a From in Single View; to do this kind of thing for a Continuous Form requires using Conditional Formatting. Also be aware that when working in Design View and changing thiskind of formatting, Access can be very tempermental. After making a this kind of change in code, you often have to close the form then re-open it. Simply making the change in code then, from Design View running the Form doesn't always show the new formatting. Occasionally you may even have to close the database then re-open it for the changes to take place.

Good Luck!

Linq ;0)>
Jul 27 '07 #3
Sorry about the confusion in my post. I am trying to code the on format event for a report. I will try .fontbold. I didn't know that was how to set the weight, nor could I find that information anywhere.

I will respond with how it works. Thanks to all that replied !!!!
Jul 28 '07 #4
Thank you to all !!!

It works great. I decided just to bold some key fields instead of the whole line. DamonReid's code works perfectly. Just used an if else to toggle between bold and normal during the OnFormat event of a Reports detail line.
Jul 29 '07 #5

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

Similar topics

2
by: fish | last post by:
Hi, I have an HTML page with a FORM and some input fields. On the fields I wish to do validation as the punters change the field values. If they get it wrong, then I tell them and then wish...
4
by: Richard Cornford | last post by:
For the last couple of months I have been trying to get the next round of updates to the FAQ underway and been being thwarted by a heavy workload (the project I am working on has to be finished an...
2
by: Derek Erb | last post by:
I have a field in a report which is filled by a function. This is because I want the values displayed in a particular way. The field is filled with: strVal = Format(ValLow, "$#,###") & " / " &...
4
by: DebbieG | last post by:
I have a form based on this query: SELECT Students.LastSerDT, OtherInfo.Served, OtherInfo.HSGradYr, OtherInfo.ActivePart, OtherInfo.Served, Students.SSN, & ", " & & " " & AS Name,...
18
by: Dixie | last post by:
Can I set the Format property in a date/time field in code? Can I set the Input Mask in a date/time field in code? Can I set the Format of a Yes/No field to Checkbox in code? I am working on...
13
by: sonald | last post by:
Hi, Can anybody tell me how to change the text delimiter in FastCSV Parser ? By default the text delimiter is double quotes(") I want to change it to anything else... say a pipe (|).. can anyone...
4
by: Bob | last post by:
Hi all, I've got a table that I've imported and it has junk at the top of the table, so after import I run a delete query to remove the junk lines then I'm left with the field names I want for...
11
by: harold.gimenez | last post by:
Hi group, I am trying to change the selection of an ASP Dropdownlist just like "Orange" is selected here: http://www.w3schools.com/js/tryit.asp?filename=try_dom_option_selected The...
3
by: no1zson | last post by:
I have been working on this application for weeks now, it is almost finished, but I am getting errors that I am unable to work through. Can someone look at my code and see if anything stands out...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
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: 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...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
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.