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 / Reports / Printing / October 2005

Tip: Looking for answers? Try searching our database.

Onactivate event and popup behaviour in reports

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Rli - 21 Oct 2005 13:18 GMT
I have a on activate event on my report filling a report field when the
report is shown in preview mode.
This did work fine until i changed the report property popup to yes (this
was necessary because the report preview is opened from a modal/pop-up form
and without poping up the report it goes behind the calling form).
And surprise....the on activate event in the report is no longer executed.

Does anyone know how to avoid this?
thanks for any help
Ofer - 21 Oct 2005 13:49 GMT
Try and use the OnOpen event of the report to assign the values instead of
the OnActivate
Signature

If I answered your question, please mark it as an answer. That way, it will
stay saved for a longer time, so other can benifit from it.

Good luck

> I have a on activate event on my report filling a report field when the
> report is shown in preview mode.
[quoted text clipped - 5 lines]
> Does anyone know how to avoid this?
> thanks for any help
Rli - 21 Oct 2005 14:00 GMT
Thank you for awnsering,
no, i did try that but it gives me a runtime error:
'you can't assign a value to this object'.

and the object is an unbound text box [Text58] in the report.

any other ideas?

> Try and use the OnOpen event of the report to assign the values instead of
> the OnActivate
[quoted text clipped - 8 lines]
> > Does anyone know how to avoid this?
> > thanks for any help
Ofer - 21 Oct 2005 14:43 GMT
If you wrote
Me.FieldName.Value = Value
change it to
Me.FieldName = Value

If that not the case, can you van post the code you are using
Signature

If I answered your question, please mark it as an answer. That way, it will
stay saved for a longer time, so other can benifit from it.

Good luck

> Thank you for awnsering,
> no, i did try that but it gives me a runtime error:
[quoted text clipped - 16 lines]
> > > Does anyone know how to avoid this?
> > > thanks for any help
Rli - 21 Oct 2005 15:09 GMT
Sorry, i don't think that's the problem. The code i wrote in the OnActivate
event is as follows:  

   Dim db As DAO.Database
   Dim rsd As DAO.Recordset
   Set db = CurrentDb
   Set rsd = db.OpenRecordset("LIBELLE")
   MsgBox "Check to see if i pass here"
   Do While Not rsd.EOF
       If Left(rsd.Fields("lib texte"), 17) = "Rédaction de bail" Then
           [Text58] = rsd.Fields("lib montant") & " € TTC"
       End If
        rsd.MoveNext
   Loop
   rsd.Close
   Set rsd = Nothing
   Set db = Nothing

When the report is opened without the popup property set to YES than this
code is executed correctly. When popup property=NO then not even the MsgBox
is displayed. So it isn't even executed......just because of the pop up
property.
???

> If you wrote
> Me.FieldName.Value = Value
[quoted text clipped - 23 lines]
> > > > Does anyone know how to avoid this?
> > > > thanks for any help
Marshall Barton - 21 Oct 2005 18:04 GMT
>I have a on activate event on my report filling a report field when the
>report is shown in preview mode.
>This did work fine until i changed the report property popup to yes (this
>was necessary because the report preview is opened from a modal/pop-up form
>and without poping up the report it goes behind the calling form).
>And surprise....the on activate event in the report is no longer executed.

Well, that's bad news.  O hadn't been aware that the
activate event and popup interacted like that.

If you want to see the value when the report is opened for
printing, then use the format event of the section
containing the control.

Alternatively, if that's too big a performance hit, use the
Open event, but set the control's ControlSource property
instead of the Value property.  E.g.  instead of using:
    [Text58] = rsd.Fields("lib montant") & " € TTC"
use this:
    [Text58].ControlSource = "=""" & rsd.Fields("lib montant")
& " € TTC"""

If you do not want to see that value when the report is
printed, then I think you're stuck.  The Activate event is
the only way I know to distinguish between previewing and
printing a report.

Signature

Marsh
MVP [MS Access]

Rli - 22 Oct 2005 09:28 GMT
That's very good Marshall,
Moving the code to the on open event and changing it to
[Text58].ControlSource = "=""" & rsd.Fields("lib montant") & " € TTC"""
works perfectly with the report preview popping up.

Thanks a lot....

> >I have a on activate event on my report filling a report field when the
> >report is shown in preview mode.
[quoted text clipped - 22 lines]
> the only way I know to distinguish between previewing and
> printing a report.
 
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.