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 » General Discussion
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Form's Last Event



 
 
Thread Tools Display Modes
  #1  
Old April 20th, 2010, 08:49 PM posted to microsoft.public.access
alex
external usenet poster
 
Posts: 581
Default Form's Last Event

Form's Last Event

Hello,
Using Access ’03…

I set my form’s record source in the form’s on load event; it’s
usually a SQL string.

I subsequently set the record source to “” in the form’s unload event
(this was suggested in posts I've read).

What I’ve described above has worked rather well for me in the past…
On my latest form, I have a lot of code in the form’s on current event—
code such as setting control property values.

When my new form closes, however; I’m getting an error. I understand
the error, but I don’t understand why I’m getting it!

What appears to be happening is that the form’s on current event is
firing after the form’s unload event; i.e., the form’s record source
is set to “” (in the form’s unload event) and then values are
assigned (in the form’s current event) throwing an error. I don’t
understand why the on current event is firing after the form’s unload
event. I even tried putting—me.recordsource = “”—in the form’s on
close event, but the form’s current event is even firing after that!

Maybe this is by design, but I’m wondering where I could stick the
code such that it’s the last thing to fire.

I “fixed” the error I was getting by using “on error resume next” in
the form’s on current event, but I hate to do that.

Thanks,
alex
  #2  
Old April 20th, 2010, 09:46 PM posted to microsoft.public.access
Bill Mosca
external usenet poster
 
Posts: 65
Default Form's Last Event

Alex

The Current event can fire for all sorts of reasons. I would just move your
recordsource code to the form's Close event. That should be safe and you
won't have to resort to a Resume Next.

--
Bill Mosca, Microsoft Access MVP
http://www.thatlldoit.com


"alex" wrote:

Form's Last Event

Hello,
Using Access ’03…

I set my form’s record source in the form’s on load event; it’s
usually a SQL string.

I subsequently set the record source to “” in the form’s unload event
(this was suggested in posts I've read).

What I’ve described above has worked rather well for me in the past…
On my latest form, I have a lot of code in the form’s on current event—
code such as setting control property values.

When my new form closes, however; I’m getting an error. I understand
the error, but I don’t understand why I’m getting it!

What appears to be happening is that the form’s on current event is
firing after the form’s unload event; i.e., the form’s record source
is set to “” (in the form’s unload event) and then values are
assigned (in the form’s current event) throwing an error. I don’t
understand why the on current event is firing after the form’s unload
event. I even tried putting—me.recordsource = “”—in the form’s on
close event, but the form’s current event is even firing after that!

Maybe this is by design, but I’m wondering where I could stick the
code such that it’s the last thing to fire.

I “fixed” the error I was getting by using “on error resume next” in
the form’s on current event, but I hate to do that.

Thanks,
alex
.

  #3  
Old April 21st, 2010, 12:25 PM posted to microsoft.public.access
alex
external usenet poster
 
Posts: 581
Default Form's Last Event

On Apr 20, 4:46*pm, Bill Mosca
wrote:
Alex

The Current event can fire for all sorts of reasons. I would just move your
recordsource code to the form's Close event. That should be safe and you
won't have to resort to a Resume Next.

--
Bill Mosca, Microsoft Access MVPhttp://www.thatlldoit.com



"alex" wrote:
Form's Last Event


Hello,
Using Access ’03…


I set my form’s record source in the form’s on load event; it’s
usually a SQL string.


I subsequently set the record source to “” in the form’s unload event
(this was suggested in posts I've read).


What I’ve described above has worked rather well for me in the past…
On my latest form, I have a lot of code in the form’s on current event—
code such as setting control property values.


When my new form closes, however; I’m getting an error. *I understand
the error, but I don’t understand why I’m getting it!


What appears to be happening is that the form’s on current event is
firing after the form’s unload event; i.e., the form’s record source
is set to *“” (in the form’s unload event) and then values are
assigned (in the form’s current event) throwing an error. *I don’t
understand why the on current event is firing after the form’s unload
event. *I even tried putting—me.recordsource = “”—in the form’s on
close event, but the form’s current event is even firing after that!


Maybe this is by design, but I’m wondering where I could stick the
code such that it’s the last thing to fire.


I “fixed” the error I was getting by using “on error resume next” in
the form’s on current event, but I hate to do that.


Thanks,
alex
.- Hide quoted text -


- Show quoted text -


Hi Bill; thanks for responding.

I did move the code to the form's on close event, but the on current
event is firing after the on close event!

Is the form's on close event the absolute last event that a form would
perform? According to my research it is.

I don't know what's causing the on current event to fire; I'm thinking
it might be one/some of the control's after update events since I'm
modifying the recordsource.

Thanks,
alex
 




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 01:00 AM.


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