Access 2007 - Current Event

soringc

Registered User.
Local time
Today, 06:44
Joined
Nov 23, 2007
Messages
13
Hi,

How can I use the "Current" event in Access 2007 Reports so that I can modify the format of a field at runtime ?
I need to read the font type and size from a field and apply it to a memo field in the same record. Is there other event I can use ?

Thanks.
 
Last edited:
Boblarson,

Thank you for responding.
Unfortunately, I tried it and it doesn't execute either.
 
As Bob said, the Format event is the report event you would use to make any formatting changes before the report is rendered.
 
Bob, Pat,

Attached is the db. Please ignore the 2 errors at the beginning. I don't know where they are from. I don't see anything on the report that calls those two fields. Anyway, I'll deal with that later. Basically what I need is to read the field with the FontType and FontSize for both Questions and Answers and execute them individually from record to record.

Then I need to center the result vertically in the bix. I know there is no command inAccess to do that, but has anybody write any macros/code to accomplich that ?

Thank you very buch and I want to tell you that I appreciate your help very much.
 
It looks like the attachment didn't make it. Did you make sure to zip it?
 
I hope it'll make it this time. (I did zip it)
 

Attachments

Okay, see the attached. I added two functions to get the font name and font size. The way you were doing it, it wasn't even right to pull it. Anyway, it really isn't set up properly either but that's a whole different subject.

Also, because you wanted each record to possibly be a different font, I had to use the Detail Section's Paint event.
 

Attachments

Bob,

I ran the report and it doesn't show different fonts. I just double-clicked on "crdByTopicDateQ" and tye report came up, but all fonts were the same. I don't understand. What did I do wrong? Is it possible that it would only PRINT (on paper) different fonts?
Thanks
 
Bob,

I ran the report and all fonts are still the same throughout the whole report. They don't change as per the font fields. Is it possible that they only show on the paper? I didn't actually print it yet. I just double-clicked on the report. Should I have done something else ?

Thanks.
 
Strange, it displayed fine for me.

Just out of curiosity have you enabled the code?

enable01.png


enable02.png


enable03.png


enable04.png
 
Yes. I did now, after you told me. thank you. but it didn't help. It's strange that it shows on your PC and not on mine.?!?I have the characters available, because I can change them manually and see them.
What can it be ?
 
Bob,

I tried it on another PC. I saved it as Access 200-2003 and I ran it on a 2003 system - same thing. I don't understand how you can see different fonts and sizes.

Thanks.
 
Yes. I did now, after you told me. thank you. but it didn't help. It's strange that it shows on your PC and not on mine.?!?I have the characters available, because I can change them manually and see them.
What can it be ?

I have similar problem under thread "On Format Event Not executed"

May be there is some settings we have not done?
 
Sorry, my bad - I had thought it was changing for me. Move the code to the Detail_Format event. Now I KNOW it works.
Code:
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
    Me.txtQuestion.FontName = GetFontName(Me.txtQuestion)
    Me.txtQuestion.FontSize = GetFontSize(Me.txtQuestion)
End Sub
 
Len25 and Bob,

I just read something interesting in "Access 2007 VBA" book by Teresa Henning, Rob Cooper, etc.. (ISBN 978-0-470-04703-3, page 354 under "Current Event" :

"You can use the 'Current' event to apply custom formating to a field."

and then:

The 'Current' event does not fire when you open a report. You can use the 'Load' event of the report to set focus to a control, which will cause the 'Current' event to fire when the report is opened. Naturally, because this event fires when a record on the report receives focus, it does not fire in Print Preview"

Pretty confusing - and no examples, but that's the closest I found to the 'current' event problem.
 
So, you're telling me that this isn't working? It sure looks like it to me:

A2K7fontchange.png
 

Users who are viewing this thread

Back
Top Bottom