Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Font change in VB 1

Status
Not open for further replies.

GShen

MIS
Sep 26, 2002
561
US
Running ACCESS 2000 ADP. Is there a way to change any of the font attributes in VBA for a particular field?
Here is the problem: I have a stored procedure which is creating a list of changes for a particular record by a user. When I print the record, I do a group by and in the detail area print 1 change on each line. What I would like to do is highlight the fields on the detail line and print only 1 record. EG. Only hightlight(or bold print) the fields which are changing. All the fields have to print regardless of whether they changed or not.
I saw some stuff in an MDB which can reference the field but not in an ADP.
If there is such an animal where would I code this, in the ON OPEN EVENT? Doesn't make sense there because the data has not been loaded yet.

Anyone have any ideas or examples?

Thanks,
 
I don't have an .adp set up at home but you would normally use the OnFormat event for the Detail section to change Fonts or Fontweights (Bold) or Back Color. If you want to highlight changes you would have to set up a boolean field to register when a change occured in a field using something like the Dirty event. But you would have to do that in a form to accomplish it. If you just want values over 0 to be Black and value less than 0 to be Red then that should be fairly simple in the Format event.


Paul
 
Paul,
I see the OnFormat Event in the Detail. Didn't ever click on this before. The tried adding the logic to a field (I will end up sending a flag via the stored procedure whether to bold it or not.) to bold it as follows:
If field1flag = "yes" THEN 'from Stored procedure
field1.fontweight = "700" 'set it to bold
ELSE
field1.fontweight = "400" 'set it to normal
END IF

Holy Toledo it works!!!!!!!! The confusing part was when I entered the period after field1 I didn't see fontweight in the drop down box and Microsoft help told me this could not be done using an ADP. I put the code in for a few fields just to make sure. This is great!!!

Thanks a million. Let me give you a star.

Have a great day.
 
PaulBricker,
I have have another problem. I am doing a group by and the fields I want to bold, etc are on the group by the data is actually on the detail. If I check the fields on the header I obviously just get the 1st record. If I check it on the detail, the header record seems to already be formated. Is there a way to sync this up?
I also saw with the ON FORMAT, an ON PRINT and ON RETREAT. I couldn't find in Help what these 2 other events do?
Can you please assist again. Thanks.
 
I'm not sure I completely follow but is sounds like you want to bold something in the Group Header based on a value in the Detail section. If that's the case then you can set the value for your textbox in the Detail Format event. I just tried it with the Northwind.adp running on my office machine and in the Employee Sales By Country report I put this code in the Format Event for the Detail section.

If Me.Salesperson = "Buchanan, Steven" Then
Me.Salesperson.Fontweight = 800
Else
Me.Salesperson.Fontweight = 400
End If

When the report formated it showed "Buchanan, Steven" in Bold and the rest of the salespersons in regular weight.

If I'm missing the question, let me know.

Paul
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top