Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Forms / May 2008

Tip: Looking for answers? Try searching our database.

There must be a better way to ...

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
johnb - 12 May 2008 16:20 GMT
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!FrameFinish.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
Maurice - 12 May 2008 19:16 GMT
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
Signature

Maurice Ausum

> Hi All
>  I have a Form and Subform with 40 something Combo, Text and Memo controls.
[quoted text clipped - 39 lines]
>
> johnb
Linq Adams - 12 May 2008 19:31 GMT
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.

Signature

There's ALWAYS more than one way to skin a cat!

Answers/posts based on Access 2000/2003

Maurice - 12 May 2008 20:06 GMT
Yep, correct... should have mentioned that.
Signature

Maurice Ausum

> I believe you'll also need to qualify the type of controls you're looping
> thru. Checking to see if
[quoted text clipped - 3 lines]
> on a control that doesn't have a Value /OldValue property, such as a label,
> will throw an error if I remember correctly.
johnb - 13 May 2008 09:26 GMT
Hi Maurice and Linq

Thanks for the comments. I shall now try and implement them. Speak to you
soon.

johnb

> Yep, correct... should have mentioned that.
>
[quoted text clipped - 5 lines]
> > on a control that doesn't have a Value /OldValue property, such as a label,
> > will throw an error if I remember correctly.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.