The weirdest problem

Montez659

Well-known Member
Joined
May 4, 2005
Messages
918
Maybe I should subtitle this "that is darn near impossible to track down."

Please allow me to explain. I have an AutoExec that triggers a form to open (still a problem even if AutoExec does not run). Upon opening, the ****** event is triggered and then I am asked for parameters for two comboboxes which should have been populated by this point by
Code:
 Me.cmbYear.Value = Year(Date)
Me.cmbChooseMonth.Value = Month(Date)

However, they are obviously not being populated correctly or else I would have not been prompted for parameters. If I cancel or continue without entering anything I get an error, the form loads, albeit blank in several areas where the appropriate query did not run.

Here's where it gets weirder...

It will continue to do this no matter how many times I close the form or put it into design mode and then reopen it.

However, if I open VBA, the problem completely disappears and the form opens as it should with all queries working correctly. Even if I do not alter any of the VBA at all, the mere fact of opening the VBA window solves the problem.

Think about it, get back to me. Thanks!
 

Excel Facts

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.
I think there's no real answer to your question as it's not something that should happen. I would look for bugs in the program logic and scrutinize the form code/control events/SQL statements. Generally if you can break it into to pieces to isolate the variables it helps - i.e., test the form as you add/remove items one by one (to the extent possible). It is possible that there's some piece of stray binary data in your form that's mucking it up, but your (albeit vague) description suggests that a lot is going on ... and most of the time that means we've made a programming error.
 
Upvote 0
What exactly are you using AutoExec for?
 
Upvote 0
Ironically, the problem seems to have solved itself. I hate it when that happens! Lol.

There is actually quite a bit that is going on with the form. There are about three listboxes and a couple of textboxes with equations in them. Pretty much it is my beginning form for that transaction/budgeting db that you and I were discussing a while back.

The crazy part is that I wanted to step through my code, and I couldn't because anytime I opened the VBA window to mark my lines to halt on, everything worked properly. I guarantee that I will go through the code line by line with a fine-toothed comb to see what is going on!

Norie, the Autoexec had one piece to it and that was opening the form.

Oh, and I never noticed that O n L o a d got starred out earlier. Sorry 'bout that.
 
Upvote 0
Why not just set this form to open when the database opens?
 
Upvote 0

Forum statistics

Threads
1,224,607
Messages
6,179,871
Members
452,949
Latest member
Dupuhini

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top