Object variable or with block variable not set error (1 Viewer)

adamtate94

Registered User.
Local time
Yesterday, 23:19
Joined
Sep 6, 2016
Messages
31
Hi could anyone give me some reasons why this error is occurring?
see attached :)
thanks
 

Attachments

  • ErrorIF.jpg
    ErrorIF.jpg
    97.4 KB · Views: 100

JHB

Have been here a while
Local time
Today, 08:19
Joined
Jun 17, 2012
Messages
7,732
Show the code in which you get the error, also mark the codeline.
 

adamtate94

Registered User.
Local time
Yesterday, 23:19
Joined
Sep 6, 2016
Messages
31
Here it is :)
When debugging the code stops on this line and throws the error
 

Attachments

  • ErrorWith.png
    ErrorWith.png
    13.5 KB · Views: 115

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Today, 01:19
Joined
Feb 28, 2001
Messages
27,191
Does this fail every time, or does it work once and then fail thereafter (until you close the form and re-launch it)?

If you have not played with the locals window before, this would be a time to try it. Set a breakpoint on the "Set DB = ..." line and use the locals window to look at the variables to see their states before and after each line is executed. I'm thinking that local variables db and rs will start their existence as "Nothing" and will become something as you single-step your way through the code. If this works the first time through that click event at least as far as getting past the "Set RS = ...." line, use the F5 key to resume execution BUT LEAVE THE BREAKPOINT SET!

If my thinking is correct, this code will fail the SECOND time you execute it - but I'm not 100% certain on this, which is why I suggest the experiment. If I am right, the next time you enter that click routine, you MIGHT have a different finding about what IS and what IS NOT "Nothing."
 

Users who are viewing this thread

Top Bottom