Command Button Failure...

G

Guest

For some reason when I try to creat a command button on my form it gives a
beep and displays the following message: "Object variable or with block
variable not set"

It also doesn't allow me to continue, so I'm stuck until I figure out what's
wrong...

Any ideas?

Thanks!
 
J

J. Goddard

Usually that's a problem with your VB code; often referring to a
recordset that has been closed or not opened yet. Does the error
message give you an option to debug?


John
 
G

Guest

Thanks for responding so quickly!

No options are given to debug... just the beep and message!

The problem is that it also freezes any progress on that form...

What should I be looking for in the VB?

Heidelberg:(
 
J

J. Goddard

Hi -

check for references to a recordset (rst.movefirst, rst.BOF,
rst!fieldname, etc) that occur either before the recordset has been
opened with set rst=db.openrecordset OR after the recordet has been
closed with rst.close .

or

You will also get this error if when you execute rst=db.openrecordset,
the db object has not yet been defined with set db=.... OR has been
released with set db = Nothing

OR

You are using a "With" type of syntax (.movefirst, .EOF, .fieldname)
without having used "with rst" first:

With rst
..
..
..
End With

These are the commonest situations I have encountered; there may be
others. If you don't find the problem, post the code that runs when the
command button is clicked.

John
 

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