Copy & paste format...any help appreciated

A

ac512

Hello & belated Merry Christmas to you all!

I am using Access 2007 and have a report that automatically updates every
month (using VB). The report has 12 text boxes (1 for every month), and as
the next month updates, I would like to copy the format only from the text
box before.
EG. 2 text boxes, 1 named 200811 and the other named 200812.
Is there any way that I can copy the format of 200811 and paste special in
text box 200812 (200811 has conditional formatting that I would like to apply
to 200812). I have tried a few things but can't seem to get anything to work.

Any help would be greatly appreciated

Thanks in advance
Kind regards
AC
 
C

Clifford Bass

Hi,

You could add something like this to your modification code:

Dim fc1 As FormatCondition
Dim fc2 As FormatCondition

txtField2.BackColor = txtField1.BackColor
txtField2.FontItalic = txtField1.FontItalic
txtField2.FontName = txtField1.FontName
txtField2.FontSize = txtField1.FontSize
txtField2.FontUnderline = txtField1.FontUnderline
txtField2.FontWeight = txtField1.FontWeight
txtField2.ForeColor = txtField1.ForeColor

txtField2.FormatConditions.Delete
For Each fc1 In txtField1.FormatConditions
Set fc2 = txtField2.FormatConditions.Add(fc1.Type, fc1.Operator, _
fc1.Expression1, fc1.Expression2)
fc2.BackColor = fc1.BackColor
fc2.FontBold = fc1.FontBold
fc2.FontItalic = fc1.FontItalic
fc2.FontUnderline = fc1.FontUnderline
fc2.ForeColor = fc1.ForeColor
Next fc1

However, it seems to me that with some better design, maybe of the
report source query, you could eliminate the need to modify the report design
every month.

Hope that helps,

Clifford Bass
 
A

ac512

Thanks for your response Clifford. Your suggestion has given me some ideas.
Much appreciated

Kind regards
AC
 
J

jackie

ac512 said:
Hello & belated Merry Christmas to you all!

I am using Access 2007 and have a report that automatically updates every
month (using VB). The report has 12 text boxes (1 for every month), and
as
the next month updates, I would like to copy the format only from the text
box before.
EG. 2 text boxes, 1 named 200811 and the other named 200812.
Is there any way that I can copy the format of 200811 and paste special in
text box 200812 (200811 has conditional formatting that I would like to
apply
to 200812). I have tried a few things but can't seem to get anything to
work.

Any help would be greatly appreciated

Thanks in advance
Kind regards
AC
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top