If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
There must be a better way to ...
Hi All
I have a Form and Subform with 40 something Combo, Text and Memo controls. Users populate the form and print it. Great! all works well....er no. The user decides to change a few controls values here and there and then want the changes highlighted on screen and on the printed report. So I insert this code on the form Private Sub FrameFinish_AfterUpdate() If Me.FrameFinish.Value Me.FrameFinish.OldValue Then With Me.FrameFinish .FontWeight = 700 .ForeColor = vbRed .Tag = "T" End With End If End Sub And Screen formatting is sorted I then insert the following code in the Report and the report formatting is sorted Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer) If Forms!frm_CPS_Details_mgt.Form!SubForm1!FrameFinis h.Tag = "T" Then With Me.FrameFinish .FontWeight = 700 .FontSize = 12 .ForeColor = RGB(255, 0, 0) End With Else With Me.FrameFinish .FontWeight = 400 .ForeSize = 10 .ForeColor = RGB(0, 0, 0) End With End If End Sub But with 40 + controls setting this up and maintenance is going to be a real bummer. There must be a better way!! Help! johnb |
#2
|
|||
|
|||
There must be a better way to ...
You could loop through the controls to do the checking and based on that
change the visual state. Dim ctl as control for each ctl in me.controls if ctl.value ctl.oldvalue then .FontWeight = 700 .ForeColor = vbRed .Tag = "T" end if next In the report you can check the Tag of the control to set the various properties like: Dim ctl as control For each ctl in me.controls if ctl.tag="T" then .FontWeight = 700 .FontSize = 12 .ForeColor = RGB(255, 0, 0) else '- alternative code here... end if next hth -- Maurice Ausum "johnb" wrote: Hi All I have a Form and Subform with 40 something Combo, Text and Memo controls. Users populate the form and print it. Great! all works well....er no. The user decides to change a few controls values here and there and then want the changes highlighted on screen and on the printed report. So I insert this code on the form Private Sub FrameFinish_AfterUpdate() If Me.FrameFinish.Value Me.FrameFinish.OldValue Then With Me.FrameFinish .FontWeight = 700 .ForeColor = vbRed .Tag = "T" End With End If End Sub And Screen formatting is sorted I then insert the following code in the Report and the report formatting is sorted Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer) If Forms!frm_CPS_Details_mgt.Form!SubForm1!FrameFinis h.Tag = "T" Then With Me.FrameFinish .FontWeight = 700 .FontSize = 12 .ForeColor = RGB(255, 0, 0) End With Else With Me.FrameFinish .FontWeight = 400 .ForeSize = 10 .ForeColor = RGB(0, 0, 0) End With End If End Sub But with 40 + controls setting this up and maintenance is going to be a real bummer. There must be a better way!! Help! johnb |
#3
|
|||
|
|||
There must be a better way to ...
I believe you'll also need to qualify the type of controls you're looping
thru. Checking to see if ctl.value ctl.oldvalue on a control that doesn't have a Value /OldValue property, such as a label, will throw an error if I remember correctly. -- There's ALWAYS more than one way to skin a cat! Answers/posts based on Access 2000/2003 Message posted via AccessMonster.com http://www.accessmonster.com/Uwe/For...forms/200805/1 |
#4
|
|||
|
|||
There must be a better way to ...
Yep, correct... should have mentioned that.
-- Maurice Ausum "Linq Adams via AccessMonster.com" wrote: I believe you'll also need to qualify the type of controls you're looping thru. Checking to see if ctl.value ctl.oldvalue on a control that doesn't have a Value /OldValue property, such as a label, will throw an error if I remember correctly. -- There's ALWAYS more than one way to skin a cat! Answers/posts based on Access 2000/2003 Message posted via AccessMonster.com http://www.accessmonster.com/Uwe/For...forms/200805/1 |
#5
|
|||
|
|||
There must be a better way to ...
Hi Maurice and Linq
Thanks for the comments. I shall now try and implement them. Speak to you soon. johnb "Maurice" wrote: Yep, correct... should have mentioned that. -- Maurice Ausum "Linq Adams via AccessMonster.com" wrote: I believe you'll also need to qualify the type of controls you're looping thru. Checking to see if ctl.value ctl.oldvalue on a control that doesn't have a Value /OldValue property, such as a label, will throw an error if I remember correctly. -- There's ALWAYS more than one way to skin a cat! Answers/posts based on Access 2000/2003 Message posted via AccessMonster.com http://www.accessmonster.com/Uwe/For...forms/200805/1 |
Thread Tools | |
Display Modes | |
|
|