Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Form will not open 1

Status
Not open for further replies.

billheath

Technical User
Mar 17, 2000
299
0
0
US
I have been using a form for years with no problems. And, I have made no changes to the form or the on current VBA event. Now, every time I try to open it, Access crashes and is forced to restart. The odd thing is I can open the on current event for the form, put a {F9} to stop the VBA. When the execution reaches the {F9}, it stops. I can then press {F5} and the form will open with no further intervention.
All I am doing is stopping the VBA in the middle and then restarting from that point and it works correctly. It doesn't seem to matter where I insert the stop.
Any ideas would be appreciated.
 
Probably would be a good idea to post the OnCurrent code, so we can see what it does! Problems that can be resolved by stopping execution, part of the way through, then continuing execution, generally have something to do with timing, but without knowing what the code is doing it's hard to say.

Hope this helps!

There's always more than one way to skin a cat!

All posts/responses based on Access 2003/2007
 
Thanks for your help. I managed to fix it. All I did was copy the code to a word document and erase the procedure in VBA. I then saved and closed the db. When I reopened the db, I pasted the copied code back into the ONCURRENT event. It worked. I have no idea why but it works. I would be interested in anyone's ideas as to why.
Bill
 
> I would be interested in anyone's ideas as to why.
My crystal ball is broken and I cannot see your code in ONCURRENT event. So my guess is - you have an error on line 17

Have fun.

---- Andy

There is a great need for a sarcasm font.
 
Some form of corruption would be my guess!

I did notice something that I'm sure is unrelated to the problem, but you need to be made aware of, as it could cause other problems down the line. When you do something like this

Code:
Dim i, ix, j, k, L, m, n, p, q, r As Currency

I suspect that you think that you're dimming

i, ix, j, k, L, m, n, p, q and r

as Currency, but in fact, you're only dimming the Variable named r as Currency!

i, ix, j, k, L, m, n, p and q

are being dimmed as Variants! You have to explicitly Dim each Variable's Type or the Access Gnomes assume that it is a Variant.

Just thought you should know!

Hope this helps!

There's always more than one way to skin a cat!

All posts/responses based on Access 2003/2007
 
Thank you that is good to know. I assume that also applies to the other dim statements; (Dim dt, Cdt as Date)Only Cdt is the only one set as a date?
 
[tt]Dim dt, Cdt as Date[/tt] - yes, only Cdt is a Date, dt is a Variant.
You should either do:
[tt]Dim dt As Date, Cdt as Date[/tt]
or (better in my opinion)
[tt]Dim dt As date,
Dim Cdt as Date[/tt]

Have fun.

---- Andy

There is a great need for a sarcasm font.
 
I would also recommend to compact and repair your database. Make sure to make a backup first. Also in the vbe make sure to select "Debug" then "compile"
 
On the back of MajP - I would recommend that you import EVERYTHING into a new database, then follow MajP's directions.
This ensures that all 'loose' references are removed completely.

D

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top