473,399 Members | 2,146 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,399 software developers and data experts.

Form_Load event not firing

Seth Schrock
2,965 Expert 2GB
I've got a form whose Form_Load event isn't running. The Form_Open event runs fine as do the button's on the form. I have removed the link in the properties window and recreated the event as was suggested by all the online forums. I have a breakpoint setup on the first line of executable code and it doesn't do anything. I don't know what else to try.
Oct 10 '14 #1
9 3136
NeoPa
32,556 Expert Mod 16PB
What does the value in the Property window say for Load?
Oct 10 '14 #2
Seth Schrock
2,965 Expert 2GB
Copy/Paste = [Event Procedure]. I wiped that out, and clicked on the ellipsis, selected Code Builder and it went directly to my code.

I'm opening it as a Dialog window and I have it's Modal and Pop Up properties set to Yes. There are no subforms involved. I don't think that these setting make any difference on what events fire as I have used these properties before and never had any trouble, but I thought that I would mention it.
Oct 10 '14 #3
jforbes
1,107 Expert 1GB
If you are sure that it should be running, but it isn't you might be getting into a bit of corruption.

A few things to try:
  • Copy your Form, Recompile and Save. Then test with your Copied Form.
  • Blow away all the code for the Form_Load (Copy to a text file first). Compile and Save, then re-open, and attempt to add it again by clicking the Event Ellipse on the Property Window.
  • Create a new Form and paste your startup code into the Form_Load and see if it gets Executed. If so, copy the controls and the rest of the code over, Copy over the properties on your Form, re-setup all the Events for your controls by clicking on the Event Ellipse on the controls Property then selecting Code Builder. .. I know this doesn't sound like fun, but it might get you past your problem.
  • If all else fails, create a new Database and Import all the objects.

Visual Studio/Winforms likes to do this every so often and the easiest way to fix it is to edit the Form Source, but that's really not an option here.
Oct 10 '14 #4
Seth Schrock
2,965 Expert 2GB
Numbers 1 and 2 didn't work, but number 3 seems to be working. Now to start copying over 160 lines of code...

I had just created the event too. It never did work. I'm starting to get several corrupted forms now. Very frustrating.
Oct 10 '14 #5
jforbes
1,107 Expert 1GB
Make backup copies as soon as possible. You may need to resort to importing into a new database soon. =(
Oct 10 '14 #6
Seth Schrock
2,965 Expert 2GB
If I remove the link to the Form_Open event, everything works fine. If I reconnect the link to the Form_Open event, the Form_Load event doesn't fire. I have verified this on both the old and the new (from scratch) forms.

Here is what I have in the Form_Open event:
Expand|Select|Wrap|Line Numbers
  1. Dim strSQL As String
  2.  
  3. strSQL = "SELECT CS.CustID_fk, S.Service, CS.Used " & _
  4.          "FROM Options_Services AS S INNER JOIN Customer_CustomerServices AS CS " & _
  5.          "ON S.ServiceID_pk = CS.ServiceID_fk " & _
  6.          "WHERE CustID_fk = " & g_CustomerID
  7.  
  8. Set db = CurrentDb
  9. Set rst = db.OpenRecordset(strSQL, dbOpenDynaset, dbSeeChanges)
  10. Set Me.Recordset = rst
  11.  
  12. Me.Service.ControlSource = "Service"
  13. Me.Used.ControlSource = "Used"
Both the db and rst variables are declared as module level variables. Does this help it make sense that the Form_Load event isn't firing?
Oct 10 '14 #7
jforbes
1,107 Expert 1GB
This seems fun.

Instead of this:
Expand|Select|Wrap|Line Numbers
  1. Dim strSQL As String
  2.  
  3.  strSQL = "SELECT CS.CustID_fk, S.Service, CS.Used " & _
  4.           "FROM Options_Services AS S INNER JOIN Customer_CustomerServices AS CS " & _
  5.           "ON S.ServiceID_pk = CS.ServiceID_fk " & _
  6.           "WHERE CustID_fk = " & g_CustomerID
  7.  
  8.  Set db = CurrentDb
  9.  Set rst = db.OpenRecordset(strSQL, dbOpenDynaset, dbSeeChanges)
  10.  Set Me.Recordset = rst
  11.  
Maybe try:
Expand|Select|Wrap|Line Numbers
  1. Dim strSQL As String
  2.  
  3.  strSQL = "SELECT CS.CustID_fk, S.Service, CS.Used " & _
  4.           "FROM Options_Services AS S INNER JOIN Customer_CustomerServices AS CS " & _
  5.           "ON S.ServiceID_pk = CS.ServiceID_fk " & _
  6.           "WHERE CustID_fk = " & g_CustomerID
  7.  
  8. Me.RecordSource = strSQL 
Also, what is happening in Form_Open? I doubt there would be something to actually stop Form_Load, but it's possible.
Oct 11 '14 #8
Seth Schrock
2,965 Expert 2GB
I'm using transaction commit/rollback, so I think that I need to have it be Recordset and not RecordSource. However, I'm no expert on this type of solution, so I may be wrong. I could test it though to see if setting the form's recordset in the Form_Open event is stopping the Form_Load event from running. To me, that would make no sense, but that doesn't mean anything.
Oct 11 '14 #9
Seth Schrock
2,965 Expert 2GB
Bingo. If I comment out line 10 in post #7, then the Form_Load event runs. If I uncomment it, Form_Load doesn't run. Now to test the transaction Commit/Rollback functionality without using Recordset.

Has anyone else noticed this? I checked Allen Browne's list of bugs, but didn't see it listed.
Oct 11 '14 #10

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: Steve M | last post by:
Why are my sessions lasting so long? I have them set to 20 minute timeout in config file? The Session_End event is getting called an hour or more sometimes--well after the user has stopped...
5
by: MS Newsgroups | last post by:
Hi, I have a scenario where I am dynamically adding a control from code when a controls event is fired. The problem I have is that when the newly created control is clicked, the click event does...
7
by: Shane Bishop | last post by:
I've been fighting with the Page_Load event firing twice. I looked through this user group and saw several other people having similar problems. There were various reasons for it:...
8
by: Paul | last post by:
Hi, In a class i built, i fire an event when a field changes. In a webform that has an instance of the class, the event (from the class) is fired and the code is executed. However, my webpage...
4
by: Larry Morris | last post by:
The following code, pasted into a web form with a link button on it, will cause the page_unload event to fire twice. If I remove the response.redirect, the problem goes away :). I've got a work...
4
by: Seraph | last post by:
Again, I'm rather new here, so if I fail to follow any etiquette, please forgive me and let me know what I've done wrong, but I think this might interest quite a few people. One of my colleaques...
2
by: Dan | last post by:
I have an aspx page with a form on it. There are a couple of textboxes and an ImageButton. The page is loaded from another page using Server.Transfer. When I click on the ImageButton, the...
6
by: crk2 | last post by:
Here a simple one. (At least I think it is?) and any help would be truly appreciated. I have an inherited textbox on my form based on a custom texbox control. It looks something like this ...
0
by: hazz | last post by:
I would like to have control over datagridview events so that when a user 'single clicks' anywhere on the grid, a method call is made to a service and if a user 'double clicks' a Customer detail...
16
by: tommaso.gastaldi | last post by:
Hello, A probably dumb question... does anyone know hot to avoid that if one keep the mouse pressed on an arrow of the numericUpDown it continues to fire events (it uses evidently a timer) ?...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.