Go Back   Access World Forums > Microsoft Access Discussion > Modules & VBA

 
Reply
 
Thread Tools Rate Thread Display Modes
Old 11-16-2018, 07:53 AM   #16
dkmoreland
Newly Registered User
 
Join Date: Dec 2017
Posts: 121
Thanks: 55
Thanked 0 Times in 0 Posts
dkmoreland is on a distinguished road
Re: Access closing unexpectedly after editing VBA

I think I am out of my league on this problem - I still can't get it to compile.
The GoToRow function that it is crashing on is a Public function in another module.


Plus now, one of my reports has started crashing with an 'expression is too complex to be evaluated" error. It's just a date range from a form, passed to a query. The weird thing is, it works fine if the dates are previous to 10/31/18. Once we get to November, it blows up. I checked the data - there are no wonky data entry errors for November that would cause this. The dates are simple short dates.

And I can't debug it because the debugger is acting so freaking weird - throwing in characters that I did not type, inserting spacing unnecessarily, etc. I can't even set print.debug break points - it keeps changing the syntax incorrectly.


If the query will evaluate 10/31/18, why won't it evaluate 11/01/18?

I also need some new swear words. I appreciate the responses to my post thus far - unfortunately, I am not making any progress. Any additional insight would be most welcome.

dkmoreland is offline   Reply With Quote
Old 11-16-2018, 07:59 AM   #17
Minty
AWF VIP
 
Minty's Avatar
 
Join Date: Jul 2013
Location: UK - Wiltshire
Posts: 5,783
Thanks: 139
Thanked 1,561 Times in 1,533 Posts
Minty has a spectacular aura about Minty has a spectacular aura about Minty has a spectacular aura about
Re: Access closing unexpectedly after editing VBA

Any chance of trying to open the database on another machine ?

It would remove the possibility of a local windows/office/access issue.

Do you have a working backup someone else could try opening?
__________________
If we have helped please add to our reputation - click the scales symbol on the left, tick 'I approve' and leave a comment.

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.


To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
Minty is offline   Reply With Quote
Old 11-16-2018, 08:13 AM   #18
dkmoreland
Newly Registered User
 
Join Date: Dec 2017
Posts: 121
Thanks: 55
Thanked 0 Times in 0 Posts
dkmoreland is on a distinguished road
Re: Access closing unexpectedly after editing VBA

Quote:
Originally Posted by Minty View Post
Any chance of trying to open the database on another machine ?

It would remove the possibility of a local windows/office/access issue.

Do you have a working backup someone else could try opening?
This is a split database - I have opened the front end on several different machines and the problem is the same. I'm pretty sure it's not a local windows/access issue.

The most recent backups behave the same way, regardless of which machine is used.

I just had a thought - this did not start happening until I added a hidden idle timeout form triggered by an autoexec macro.

Could this have caused this problem?

dkmoreland is offline   Reply With Quote
Old 11-16-2018, 08:17 AM   #19
psyc0tic1
Access Moron
 
Join Date: Jul 2017
Posts: 352
Thanks: 168
Thanked 7 Times in 4 Posts
psyc0tic1 is on a distinguished road
Re: Access closing unexpectedly after editing VBA

Quote:
Originally Posted by dkmoreland View Post
I just had a thought - this did not start happening until I added a hidden idle timeout form triggered by an autoexec macro.

Could this have caused this problem?
Have you tried removing that?

Does it crash as you described if you open the database by holding down the SHIFT key and clicking the DB? That should bypass the AutoExec and any other code.
__________________
Richard
Access 2013, Windows 7 64 bit
psyc0tic1 is offline   Reply With Quote
Old 11-16-2018, 08:19 AM   #20
Minty
AWF VIP
 
Minty's Avatar
 
Join Date: Jul 2013
Location: UK - Wiltshire
Posts: 5,783
Thanks: 139
Thanked 1,561 Times in 1,533 Posts
Minty has a spectacular aura about Minty has a spectacular aura about Minty has a spectacular aura about
Re: Access closing unexpectedly after editing VBA

Active form timers really mess with the VBA editor. All sorts of strange things can happen.
Deactivate it and try again.
__________________
If we have helped please add to our reputation - click the scales symbol on the left, tick 'I approve' and leave a comment.

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.


To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
Minty is offline   Reply With Quote
Old 11-16-2018, 08:28 AM   #21
dkmoreland
Newly Registered User
 
Join Date: Dec 2017
Posts: 121
Thanks: 55
Thanked 0 Times in 0 Posts
dkmoreland is on a distinguished road
Re: Access closing unexpectedly after editing VBA

I removed the idle timeout form and the 2 macros that were connected to it. Unfortunately, it did not make a difference in either the data issue or the VBA editor issue.
dkmoreland is offline   Reply With Quote
Old 11-16-2018, 08:28 AM   #22
dkmoreland
Newly Registered User
 
Join Date: Dec 2017
Posts: 121
Thanks: 55
Thanked 0 Times in 0 Posts
dkmoreland is on a distinguished road
Re: Access closing unexpectedly after editing VBA

Also, I ran compact and repair after I removed them.

dkmoreland is offline   Reply With Quote
Old 11-16-2018, 08:29 AM   #23
isladogs
Part time moderator
 
isladogs's Avatar
 
Join Date: Jan 2017
Location: Somerset, UK
Posts: 7,350
Thanks: 92
Thanked 1,811 Times in 1,686 Posts
isladogs is a glorious beacon of light isladogs is a glorious beacon of light isladogs is a glorious beacon of light isladogs is a glorious beacon of light isladogs is a glorious beacon of light
Re: Access closing unexpectedly after editing VBA

Quote:
Originally Posted by dkmoreland View Post
I think I am out of my league on this problem - I still can't get it to compile.
The GoToRow function that it is crashing on is a Public function in another module.
Back in post #8 you posted a screenshot of your code
Here is a screenshot of that screenshot! (In future please copy the code itself)



In post #10, I explained your error.
To repeat, you have a function called GoToJob so the next line must start with GoToJob.
Using GoToRow will fail because that's not the function whose value you are trying to return

Similarly the next function GoToNCR. The second line MUST start with GoToNCR

I agree with comments about a timer event being thelikley cause of erratic behaviour

Offhand not clear what your date issue is
Attached Images
File Type: png Capture.PNG (6.8 KB, 46 views)
__________________
If this answer has helped, please click the Thanks button and/or click the 'reputation scales' symbol on the left.

Website links:
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.


Colin
Previously known as ridders : Access 2010 32-bit, Access 2016 32-bit & 64-bit, SQL Server Express 2014, Windows 10,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
isladogs is offline   Reply With Quote
Old 11-16-2018, 08:48 AM   #24
Minty
AWF VIP
 
Minty's Avatar
 
Join Date: Jul 2013
Location: UK - Wiltshire
Posts: 5,783
Thanks: 139
Thanked 1,561 Times in 1,533 Posts
Minty has a spectacular aura about Minty has a spectacular aura about Minty has a spectacular aura about
Re: Access closing unexpectedly after editing VBA

@Colin, they aren't functions, they are subs, so they may be calling another sub called GotoRow?

It is a little confusing though.
__________________
If we have helped please add to our reputation - click the scales symbol on the left, tick 'I approve' and leave a comment.

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.


To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
Minty is offline   Reply With Quote
Old 11-16-2018, 08:49 AM   #25
isladogs
Part time moderator
 
isladogs's Avatar
 
Join Date: Jan 2017
Location: Somerset, UK
Posts: 7,350
Thanks: 92
Thanked 1,811 Times in 1,686 Posts
isladogs is a glorious beacon of light isladogs is a glorious beacon of light isladogs is a glorious beacon of light isladogs is a glorious beacon of light isladogs is a glorious beacon of light
Re: Access closing unexpectedly after editing VBA

OOPS!
__________________
If this answer has helped, please click the Thanks button and/or click the 'reputation scales' symbol on the left.

Website links:
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.


Colin
Previously known as ridders : Access 2010 32-bit, Access 2016 32-bit & 64-bit, SQL Server Express 2014, Windows 10,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
isladogs is offline   Reply With Quote
Old 11-16-2018, 10:41 AM   #26
The_Doc_Man
Happy Retired Curmudgeon
 
Join Date: Feb 2001
Location: Suburban New Orleans, LA, USA
Posts: 12,568
Thanks: 62
Thanked 1,196 Times in 1,096 Posts
The_Doc_Man is a splendid one to behold The_Doc_Man is a splendid one to behold The_Doc_Man is a splendid one to behold The_Doc_Man is a splendid one to behold The_Doc_Man is a splendid one to behold The_Doc_Man is a splendid one to behold The_Doc_Man is a splendid one to behold
Re: Access closing unexpectedly after editing VBA

In a way, your approach is SIMILAR to the way that the ALGOL language and a couple of other OOP languages would "overdefine" a function. I think Pascal language does this too. The alternate subs call the same active routine with different input arguments. This is similar to overdefining a function to do something when the argument is type X and something slightly different when the argument is type Y. So I kind of understand the strategy. That SHOULD work for Access.

Usually this kind of problem is a corruption issue. Post #8 says you exported everything to another fresh DB, which should eliminate corruption. Did you get any errors when you did that? AND did everything you intended to import actually show up? (I know that you reported that the compilation error persisted, but I'm talking about errors during the export process and errors of failing to copy something.)

JHB's comment is important. When Access says Function or Sub not found, that is unequivocal. You claim that GoToRow is defined as Public in a General Module. I want you to run a quickie experiment. It will be simple.

Get to a VBA editing page. Open Object Browser. Select "<all libraries>" in the library selector and then type in "GoToRow" in the search box. Click the search (binoculars) button. How many times does GoToRow show up?

The answer will be 0, 1, or (maybe) 2 or more. If ZERO then that name isn't visible. If 1, then it should be listed as a Sub entry in your project. If MORE than 1, you have a keyword conflict.

From the VBA editor, don't try to compile - but DO try to search (the entire project) for every occurrence of the GoToRow string. Use the Whole Word Match option but the Match Case option is not required. Verify that you have one and only one definition of the Sub entry point and verify that the entry point is spelled exactly the same way as the references to it.

OK, here is the "big gun." Be sure that whatever you are doing, you have a system clock time visible, perhaps at the lower right of the screen in the Windows Task Bar. Now go through the process that causes Access to crash. IMMEDIATELY note the time of day. It is usually enough for it to be accurate to the minute.

Now use the Start Button to get to the Detailed Control Panel to run Administrative Tools. Find the Event Viewer and open it. In the navigation panel to the left, you will have several logs - system logs, application logs, possibly device logs, possibly security logs, and sometimes there are specialty logs such as Office logs. (The latter is rare - but possible.)

One by one, go through the logs, which are sorted by time with the most recent time at the top of the list (so Ctrl/HOME will jump-scroll there). Look for a logged event relating to MSACCESS.EXE from the time of day of that contrived crash. Also check for device errors like disk or memory errors. (The latter would be EXCEEDINGLY rare.)

Whatever you find, if related to this event, should be in the same minute that you noted when the crash occurred because system logs and the time display in the task bar BOTH get their times from the system internal date/time clock. If you find one log, don't stop there. Look through all the logs for something at that specific time. The text of the error will tell you which library module and which executable image failed. There will be an "Exception" code as well.

If you find something in the event log, you should be able to do a cut/paste on the text. If so, bring it here.
__________________
I'm a certified grandpa (3 times now) and proud of it.
Retired over one year and survived being home all day with the wife. She must really love me.
If I have helped you, please either click the thanks or click the scales.
The_Doc_Man is offline   Reply With Quote
Old 11-16-2018, 10:47 AM   #27
The_Doc_Man
Happy Retired Curmudgeon
 
Join Date: Feb 2001
Location: Suburban New Orleans, LA, USA
Posts: 12,568
Thanks: 62
Thanked 1,196 Times in 1,096 Posts
The_Doc_Man is a splendid one to behold The_Doc_Man is a splendid one to behold The_Doc_Man is a splendid one to behold The_Doc_Man is a splendid one to behold The_Doc_Man is a splendid one to behold The_Doc_Man is a splendid one to behold The_Doc_Man is a splendid one to behold
Re: Access closing unexpectedly after editing VBA

As an afterthought... This should ALSO be incredibly rare to happen, but let's rule out even some of the unlikely things with simple steps.

1. Can you/did you Compact & Repair the BE file?

2. Do you have any code in the BE file to be run in case someone tried to directly open it? If so, can you decompile & recompile the BE? (If not, the C&R from #1 should suffice.)
__________________
I'm a certified grandpa (3 times now) and proud of it.
Retired over one year and survived being home all day with the wife. She must really love me.
If I have helped you, please either click the thanks or click the scales.
The_Doc_Man is offline   Reply With Quote
Old 11-16-2018, 11:00 AM   #28
dkmoreland
Newly Registered User
 
Join Date: Dec 2017
Posts: 121
Thanks: 55
Thanked 0 Times in 0 Posts
dkmoreland is on a distinguished road
Re: Access closing unexpectedly after editing VBA

Thanks to all of you, I have made some progress. I installed V-tools and did a deep search on the GotoRow sub. I found it in 3 different forms. I'm not sure why it was there - this is an inherited system and I saw no evidence the code was even in use. So I commented it out everywhere I found it. I will test and make sure nothing has stopped working but for now it looks like it was just abandoned code.

Then I went through and set everything to Option Explicit and tried to compile. Everything that it stopped on was an undeclared variable. So I fixed those one at a time and was able to get all the way through.

After that, I did a compact and repair. So, the VBA editor seems to be working again and Access is not unexpectedly closing on me (at least it hasn't in the last hour or so.

I'm still searching for a reason for the run time error I mentioned earlier when running a report for November data. It makes no sense that it wouldn't be able to evaluate dates after 10/31/18.

But, at least I can debug now and that is no small thing.

Thanks to everyone that contributed advice. I appreciate it.
dkmoreland is offline   Reply With Quote
Old 11-16-2018, 01:08 PM   #29
The_Doc_Man
Happy Retired Curmudgeon
 
Join Date: Feb 2001
Location: Suburban New Orleans, LA, USA
Posts: 12,568
Thanks: 62
Thanked 1,196 Times in 1,096 Posts
The_Doc_Man is a splendid one to behold The_Doc_Man is a splendid one to behold The_Doc_Man is a splendid one to behold The_Doc_Man is a splendid one to behold The_Doc_Man is a splendid one to behold The_Doc_Man is a splendid one to behold The_Doc_Man is a splendid one to behold
Re: Access closing unexpectedly after editing VBA

Interesting that you found it in three forms. The question is, was it in the form's class module for the form you were editing that led to the crash? Scoping rules suggest that the closest thing wins, so in a form containing a GoToRow sub entry point, the Public version in the general module SHOULD not have been visible.

The report problem could have been a myriad of things, given that you had errors of the type that were detected by adding Option Explicit. The report crash COULD have been totally unrelated to the other problem. If you stick with Option Explicit and fix the GoToRow issues, you SHOULD have smoother sailing ahead. Good luck!

__________________
I'm a certified grandpa (3 times now) and proud of it.
Retired over one year and survived being home all day with the wife. She must really love me.
If I have helped you, please either click the thanks or click the scales.
The_Doc_Man is offline   Reply With Quote
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Editing a recordset before closing data entry form bentheimmigrant Forms 3 03-09-2016 07:19 AM
"Run-time error '2455'" when closing Access after making editing changes to a form mrb783 Modules & VBA 1 01-22-2009 02:30 PM
Access quitting unexpectedly trandel Forms 10 04-21-2007 01:11 AM
[SOLVED] Access Quits Unexpectedly CBI Modules & VBA 1 05-19-2006 12:45 PM
Access unexpectedly shuts down on a form!!! Cocis91 Forms 3 01-28-2002 05:23 AM




All times are GMT -8. The time now is 08:57 PM.


Microsoft Access Help
General
Tables
Queries
Forms
Reports
Macros
Modules & VBA
Theory & Practice
Access FAQs
Code Repository
Sample Databases
Video Tutorials

Featured Forum post


Sponsored Links


Powered by vBulletin®
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.
(c) copyright 2017 Access World