PC Review


Reply
Thread Tools Rate Thread

CancelEvent code issue

 
 
robertfuschetto via AccessMonster.com
Guest
Posts: n/a
 
      28th Mar 2006
On an Access Report, on the 'On Format' for a footer, I want to suppress the
footer when: table.item = 'suppress'. I figure I need to use the DoCmd.
CancelEvent but I am unsure how to procede. I assume I use the code builder
to build the event but I am not sure how to code up my If condition.

--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...dules/200603/1
 
Reply With Quote
 
 
 
 
=?Utf-8?B?S2xhdHV1?=
Guest
Posts: n/a
 
      28th Mar 2006
Notice in the Function definition, there is a Cancel argument. All you have
to do is:

If table.item = "suppress" Then
Cancel = True
End If

"robertfuschetto via AccessMonster.com" wrote:

> On an Access Report, on the 'On Format' for a footer, I want to suppress the
> footer when: table.item = 'suppress'. I figure I need to use the DoCmd.
> CancelEvent but I am unsure how to procede. I assume I use the code builder
> to build the event but I am not sure how to code up my If condition.
>
> --
> Message posted via AccessMonster.com
> http://www.accessmonster.com/Uwe/For...dules/200603/1
>

 
Reply With Quote
 
robertfuschetto via AccessMonster.com
Guest
Posts: n/a
 
      29th Mar 2006
I am sorry, when I look at the help for CancelEvent it says it has no
arguments. I feel as though I am missing something staring me in the face.
You are talking about DoCmd.CancelEvent or some other Cancel funstion.

Thanks much.

Klatuu wrote:
>Notice in the Function definition, there is a Cancel argument. All you have
>to do is:
>
>If table.item = "suppress" Then
> Cancel = True
>End If
>
>> On an Access Report, on the 'On Format' for a footer, I want to suppress the
>> footer when: table.item = 'suppress'. I figure I need to use the DoCmd.
>> CancelEvent but I am unsure how to procede. I assume I use the code builder
>> to build the event but I am not sure how to code up my If condition.


--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...dules/200603/1
 
Reply With Quote
 
=?Utf-8?B?S2xhdHV1?=
Guest
Posts: n/a
 
      29th Mar 2006
I am talking about the Report Footer Format event. Notice its definition:
Private Sub ReportFooter_Format(Cancel As Integer, FormatCount As Integer)
^^^^
It is the Cancel argument you need to use here.

If table.item = "suppress" Then
Cancel = True
End

Setting Cancel to True causes the report to ingore formatting for the
current record.


"Klatuu" wrote:

> Notice in the Function definition, there is a Cancel argument. All you have
> to do is:
>
> If table.item = "suppress" Then
> Cancel = True
> End If
>
> "robertfuschetto via AccessMonster.com" wrote:
>
> > On an Access Report, on the 'On Format' for a footer, I want to suppress the
> > footer when: table.item = 'suppress'. I figure I need to use the DoCmd.
> > CancelEvent but I am unsure how to procede. I assume I use the code builder
> > to build the event but I am not sure how to code up my If condition.
> >
> > --
> > Message posted via AccessMonster.com
> > http://www.accessmonster.com/Uwe/For...dules/200603/1
> >

 
Reply With Quote
 
robertfuschetto via AccessMonster.com
Guest
Posts: n/a
 
      29th Mar 2006
The following code yeilds a Run Time 424 - Object Required Error. I assure
you the table and field name are correct.


Private Sub GroupFooter5_Format(Cancel As Integer, FormatCount As Integer)
If tblPhysicianProfileReportData.EncounterType = "none" Then
Cancel = 1
End If
End Sub

Ideas?

Klatuu wrote:
>I am talking about the Report Footer Format event. Notice its definition:
>Private Sub ReportFooter_Format(Cancel As Integer, FormatCount As Integer)
> ^^^^
>It is the Cancel argument you need to use here.
>
>If table.item = "suppress" Then
> Cancel = True
>End
>
>Setting Cancel to True causes the report to ingore formatting for the
>current record.
>
>> Notice in the Function definition, there is a Cancel argument. All you have
>> to do is:

>[quoted text clipped - 7 lines]
>> > CancelEvent but I am unsure how to procede. I assume I use the code builder
>> > to build the event but I am not sure how to code up my If condition.


--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...dules/200603/1
 
Reply With Quote
 
=?Utf-8?B?S2xhdHV1?=
Guest
Posts: n/a
 
      29th Mar 2006
Yes, What is tblPhysicianProfileReportData.EncounterType ?
If you are trying to reference a field in a table here, that is not correct.
You need to be looking at a control on your report. The only way your code
would be correct is if you had a recordset open and you had
tblPhysicianProfileReportData identified as the recordset name. Even then,
it would see .EncounterType as a property, not as a field. If it were a
field it should be referenced as !EncounterType.

One other thing, Use Cancel = True rather than Cancel = 1. That is not
causing the error, but it is better coding practice. The above reference to
tblPhysicianProfileReportData.EncounterType is the problem.

"robertfuschetto via AccessMonster.com" wrote:

> The following code yeilds a Run Time 424 - Object Required Error. I assure
> you the table and field name are correct.
>
>
> Private Sub GroupFooter5_Format(Cancel As Integer, FormatCount As Integer)
> If tblPhysicianProfileReportData.EncounterType = "none" Then
> Cancel = 1
> End If
> End Sub
>
> Ideas?
>
> Klatuu wrote:
> >I am talking about the Report Footer Format event. Notice its definition:
> >Private Sub ReportFooter_Format(Cancel As Integer, FormatCount As Integer)
> > ^^^^
> >It is the Cancel argument you need to use here.
> >
> >If table.item = "suppress" Then
> > Cancel = True
> >End
> >
> >Setting Cancel to True causes the report to ingore formatting for the
> >current record.
> >
> >> Notice in the Function definition, there is a Cancel argument. All you have
> >> to do is:

> >[quoted text clipped - 7 lines]
> >> > CancelEvent but I am unsure how to procede. I assume I use the code builder
> >> > to build the event but I am not sure how to code up my If condition.

>
> --
> Message posted via AccessMonster.com
> http://www.accessmonster.com/Uwe/For...dules/200603/1
>

 
Reply With Quote
 
robertfuschetto via AccessMonster.com
Guest
Posts: n/a
 
      29th Mar 2006
Yes I was referencing a table item not a report item. I think its working
now...THANKS!!!!!!!!!!!!!!!!!!!!!

Klatuu wrote:
>Yes, What is tblPhysicianProfileReportData.EncounterType ?
>If you are trying to reference a field in a table here, that is not correct.
> You need to be looking at a control on your report. The only way your code
>would be correct is if you had a recordset open and you had
>tblPhysicianProfileReportData identified as the recordset name. Even then,
>it would see .EncounterType as a property, not as a field. If it were a
>field it should be referenced as !EncounterType.
>
>One other thing, Use Cancel = True rather than Cancel = 1. That is not
>causing the error, but it is better coding practice. The above reference to
>tblPhysicianProfileReportData.EncounterType is the problem.
>
>> The following code yeilds a Run Time 424 - Object Required Error. I assure
>> you the table and field name are correct.

>[quoted text clipped - 24 lines]
>> >> > CancelEvent but I am unsure how to procede. I assume I use the code builder
>> >> > to build the event but I am not sure how to code up my If condition.


--
Message posted via http://www.accessmonster.com
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
CancelEvent Peter Microsoft Access Form Coding 2 1st Dec 2009 01:44 PM
CancelEvent Geoff Microsoft Access VBA Modules 6 20th Jun 2006 04:42 PM
Is it Escape, Undo or CancelEvent? Mike Boozer Microsoft Access Form Coding 6 29th Apr 2004 03:24 AM
CancelEvent Mike Microsoft Access Form Coding 0 28th Aug 2003 05:05 PM
CancelEvent not working. gee Microsoft Access Form Coding 2 18th Aug 2003 03:23 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 12:47 AM.