473,387 Members | 1,532 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Current event fires twice - how to excute code just once?

I'm surprised that the Current event of forms always fires twice
(Access XP).
I have quite a lot of processing done in the current event, how to make
the code run just once?

Thanks

Mar 23 '06 #1
3 5630
<do******@hotpop.com> wrote in message
news:11**********************@g10g2000cwb.googlegr oups.com...
I'm surprised that the Current event of forms always fires twice
(Access XP).
I have quite a lot of processing done in the current event, how to make
the code run just once?


I have never noticed that happening on any of my forms. Perhaps your actual
code is somehow calling itself or calling another procedure/function that is
producing the second run.

If you have nothing in your current event but a MsgBox() do you see it displayed
twice?

--
I don't check the Email account attached
to this message. Send instead to...
RBrandt at Hunter dot com
Mar 23 '06 #2

<do******@hotpop.com> wrote in message
news:11**********************@g10g2000cwb.googlegr oups.com...
I'm surprised that the Current event of forms always fires twice
(Access XP).
I have quite a lot of processing done in the current event, how to make
the code run just once?

Thanks


As Rick says, this doesn't sound like any known issue - more likely your
coding. If you created a new blank form based on a table and pasted in:

Dim m_lngCount As Long

Private Sub Form_Current()
m_lngCount = m_lngCount + 1
Me.Caption = CStr(m_lngCount)
End Sub

You would see from the caption that you were going up in ones, not twos, so
the current event must only be firing once.

Is there some form of re-query or re-setting the form's recordsource?
Mar 23 '06 #3
Bri

do******@hotpop.com wrote:
I'm surprised that the Current event of forms always fires twice
(Access XP).
I have quite a lot of processing done in the current event, how to make
the code run just once?


Are you are referring to it running twice when a Form (or is it a
subForm) first opens? I've seen this and it seems that there is nothing
you can do to stop it from running twice, but you can put in a test to
see if it is the first time or subsequent times. What seems to happen is
that the Current Event fires when the Form first opens, before the
recordsource is loaded, and then again after it has the recordset and
arrives on the first record. Unfortunately any test for the existence of
the recordsource (or its clone) produces an error if it doesn't yet have
one. You could trap that error so it doesn't get displayed. I don't know
off the top of my head what circumstances actually cause it, but I have
definitely had it happen to me too.

--
Bri

Mar 24 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Matt | last post by:
Hello, I just don't get it. I have a simple webform1.aspx page, when loaded for the first time, the load even fires which is fine. In webform1.aspx i have a button that has a onclick event,...
6
by: Michael Johnson Jr. | last post by:
I am trying to handle a button click event, which updates a web control table with data. The button is dynamically created in the table itself. When I call updateTable() in the Page_Load the new...
7
by: Jay Douglas | last post by:
Hello all, I have a asp.net page that creates a pdf on the fly and sends the pdf down to the browser. When calling the page up in IE the Page_Load event is fried twice. This doesn't happen with...
1
by: Bill Manring | last post by:
The startup page for my ASP.NET application is an HTML frames page with two frames. This seems to cause the Session_Start event in the Global.asax file to fire twice. When I change the startup...
3
by: RR | last post by:
I have a button on a form (form A) that opens another form. The form that opens (form B) has a listbox that is populated with a call to a function in the "on current" event. When form B with the...
3
by: Techsatish | last post by:
how to make a mouseup event called only once during a double click event? here double click is made on a tree node in a tree control. I have the code inside mouseup event....in runtime the...
5
by: christianlott1 | last post by:
I admit my form is pretty complex and may need a total overhaul - I have two subforms synchronized on a form through an unbound text box. When I enter a new record in the second subform it used...
0
by: manywolf | last post by:
I have an aspx page that fires the page load event twice for every load. I tried every fix that was suggested in all the posts on this and other forums. None changed the behavior. After one post that...
3
by: =?Utf-8?B?QmFycnkgR2lsYmVydA==?= | last post by:
I have a class that raises events that downstream objects subscribe to. In one case, after destroying the object, the event seems to still get handled in a subscriber object. So I instantiate an...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.