A Microsoft Office (Excel, Word) forum. OfficeFrustration

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.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

There must be a better way to ...



 
 
Thread Tools Display Modes
  #1  
Old May 12th, 2008, 04:20 PM posted to microsoft.public.access.forms
JohnB
external usenet poster
 
Posts: 185
Default 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  
Old May 12th, 2008, 07:16 PM posted to microsoft.public.access.forms
Maurice
external usenet poster
 
Posts: 1,585
Default 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  
Old May 12th, 2008, 07:31 PM posted to microsoft.public.access.forms
Linq Adams via AccessMonster.com
external usenet poster
 
Posts: 1,474
Default 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  
Old May 12th, 2008, 08:06 PM posted to microsoft.public.access.forms
Maurice
external usenet poster
 
Posts: 1,585
Default 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  
Old May 13th, 2008, 09:26 AM posted to microsoft.public.access.forms
JohnB
external usenet poster
 
Posts: 185
Default 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

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 09:57 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.