Object variable or With block variable not set

L

laura

I'm trying to put a command button on a form using the command button wizard
and I am getting this message "Object variable or With block variable not
set". I cannot figure out what's happening. I tried opening different
instances of Access and am getting the same problem with some but not all of
my .mdb files. Hope someone can help.
Thanks,
Laura
 
J

jeff

Laura

Its hard to think what it would be with no example...
did you edit the code generated by the wizard? or is it the wizard producing
the error?
Can you paste the code here?
cheers
Jeff
 
L

laura

Hi Jeff,

Sorry I wasn't more specific.

Basically I am using XP with Office 2000. I have a program which I have been
working on for some time, it has tables, queries, forms, reports. The forms
have got text fields, labels, buttons etc., the usual things.

I am doing some new work on it and opened up the form - to add a new command
button. Clicked on the button in the toolbar and then on my form where I
wanted it placed. I then got that message "Object variable or With block
variable not set". I thougth there might be something wrong with the form,
so I opened up a brand new form not linked to a datasource and tried to add
a command button. Same error message. The command button wizard attempts to
open up, the text on the left side is there, i.e., asking what I want the
button for, Navigation, Open a Form, Run a Report, etc., but there is no
text on the right side - i.e., in the case of Navigation, no Prev, Next,
First, Last.. etc.. It's empty and the error comes up.

I tried a new .mdb file, new form, new button. Same error message. Opened up
another .mdb file I had created previously and it did work. It seems to be
random and I cannot find much on the internet that addrsses that error
message.

I hope this helps.
Laura
 
J

jeff

Laura

Sorry for not getting back to you sooner. I am a clearer on your predicament
now, but at this stage, it is beyond me. I will keep an eye on the post here
but will also have a little dig around myself in the meantime...

sorry I couldnt be more help yet...
cheers
Jeff
 
S

storrboy

Hello Laura,

Open a code window and go to the Tools > References menu. Is anything
marked as Missing? If so what is it? It may be possible to uncheck it
or to find the file and reset the reference.
 
L

laura

Hello, Thanks for taking the time. I'm beginning to worry that this may be a
"bug" on my system as it is intermittent. Sometimes it happens and sometimes
not and for no apparent reason. It just happened again when I tried adding a
command button to my form - same message. I closed the database and
re-opened it and it seems fine now. Grrrrr

I'm not sure how I would know if something was missing from the References
as I am not entirely sure what should be there in the first place, but this
is what I have:-

Visual Basic For Applications
Microsoft Access 9.0 Object Library
OLE Automation
Microsoft ActiveX Data Objects 2.1 Library
Microsoft DAO 3.6 Object Library

How would I know if something was missing?

FYI I have Office 2000 and Windows XP.

Thanks,
All the best,
Laura
 
S

storrboy

If one were missing it would be marked in that list as MISSING: So if
you didn't see that we look elsewhere. I tried to stay away from 2000,
and use the wizrds very little so my next steps would be:

1) Is this a shared DB? If so open it exclusively and if at all
possible, stop sharing it. Use a front-end/back-end setup.
2) Do a full compile of the project. In a code window choose Debug >
Compile [projectname]. Deal with any errors displayed and try the
wizard again.
3) If possible, see if you can get the Office CD and copy the
following files from it to the same folder they are currently in. Make
sure Access is not running and rename the old ones so that they can be
restored if needed. (I think the names are the same since 2000)
ACWZMAIN.MDE, ACWZTOOL.MDE, ACWZLIB.MDE, ACWZUSER.MDT, ACWZDAT.MDT
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top