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

Hunting down this error: object variable or with block variable not set

374 256MB
As topic says. Under normal database usage when I click quit I write to a log the current date/time. This is just for audit purposes to keep track of when people enter/leave the database.

However, after I have done some vb editing I always seem to get the following error when I try to exit the database using the quit button on my main form:

object variable or with blcok variable not set.


I also have a user login form whcih runs using the autoexec macro as soon as the database starts. I can produce the same error as above if I click cancel to quit the database.

I dont understand where this error can be. Under normal operation it works fine but it messes up after I have done some coding in design view or if I click this cancel button. I know it must be tied to the quitting but specifically where I can not see.

To make matters worse my breakout isnt working =| I set a breakpoint and the code always seems to be running past it. So I cant break on the button click and step through.

Appreciate any feedback on this I know it would be hard without seeing the code but if there are any pointers on what to look out for they will help a lot.

Regards,

Chris
Jul 26 '10 #1
4 2054
NeoPa
32,556 Expert Mod 16PB
When interfering with the code, your running project is often reset. I have mine set to warn me when this happens (Go to Tools / Options of the VBA IDE and select the General tab. From there ensure Notify Before State Loss is checked in the Edit and Continue area).

Once this happens (the project is reset), all the running variables that are being maintained within the project are lost, so many objects are no longer usable.

I hope this helps Chris.

PS. This is one of those where understanding the code is almost irrelevant :)
Jul 26 '10 #2
munkee
374 256MB
I have just set this so we will see how it does. But as I said before if I click cancel on the user logon page I get the same error too so I'll have a look through that code and see if there is anything that could be going wrong.

Atfer some searching I have found the offending code:

Expand|Select|Wrap|Line Numbers
  1. Public rsAlwaysOpen As Recordset
  2.  
  3.  
  4. Public Sub Form_Close()
  5. 'Start open ended error handler
  6. On Error GoTo tagError5
  7.     rsAlwaysOpen.Close
  8.     Set rsAlwaysOpen = Nothing
  9.     'Call AccessCloseButtonEnabled(True)
  10.     'End of successful code
  11.     RestoreWindow
  12. Runaway:
  13. Exit Sub
  14.  
  15. 'Handle the error type code
  16. tagError5:
  17.     MsgBox err.Description
  18.     Resume Runaway
  19. End Sub
  20.  
  21. Public Sub Form_Open(Cancel As Integer)
  22. 'Start open ended error handler
  23. On Error GoTo tagError6
  24.    Set rsAlwaysOpen = CurrentDb.OpenRecordset("tblDummy")
  25.  
  26.     'Call AccessCloseButtonEnabled(False)
  27. 'End of successful code
  28. Headforthehills:
  29. Exit Sub
  30.  
  31. 'Handle the error type code
  32. tagError6:
  33.     MsgBox err.Description
  34.     Resume Headforthehills
  35. End Sub
Jul 27 '10 #3
munkee
374 256MB
Also I found out why breakpoints were not working correctly. I had turned off Special Keys within the startup of the database.
Jul 27 '10 #4
NeoPa
32,556 Expert Mod 16PB
munkee: Atfer some searching I have found the offending code:
I'm not clear which of the lines you're referring to.
Jul 27 '10 #5

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

Similar topics

3
by: Joe Schwartz | last post by:
All, Could somebody please help me out here. I am getting an "Object variable or With block variable not set" error with the following code. This happens when I enter a value into the "ponum"...
0
by: RJN | last post by:
Hi Sorry for posting again. I'm calling a shared method in the class. The following error is found in production though I'm not able to reproduce. ...
6
by: Neo Geshel | last post by:
I am trying to deal with an image in code-behind. I consistently get the following error: Server Error in '/' Application. Object variable or With block variable not set. Description: An...
3
by: Richard Hollenbeck | last post by:
I've marked the line in this subroutine where I've been getting this error. It may be something stupid but I've been staring at this error trying to fix it for over an hour. I'm pretty sure the...
9
by: axs221 | last post by:
I am trying to move some of our large VBA Access front-end file into ActiveX DLL files. I created two DLL files so far, one was a module that contains code to integrate into the QuickBooks...
5
by: mekon | last post by:
Hi All, I'm hoping someone out there can give me a hand with this problem I've got. I have an Access DB that people connect to using Access RT 2000. There are some machines that can connect...
1
by: abhijmenbumca07 | last post by:
Object variable or With block variable not set. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information...
4
by: BrianAdev | last post by:
Why It throw an error of <Object variable or With block variable not set> set objAccess = GetObject(strMdbPath) objAccess.DoCmd.SetWarning False objAccess.DoCmd.OpenReport strReportName, 0 'It...
3
by: Newbie19 | last post by:
I'm trying to get a list of all subfolders in a folder on a share drive, but I keep on getting this error message: Object variable or With block variable not set. Description: An unhandled...
5
by: Al G | last post by:
Hi, I'm converting a bit of POP3 VB6 code to VB2005, and have run into this error with the following code. Can someone help me find out what I'm missing/doing wrong? 'holds the attachments...
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: 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?
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
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
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.