Error sources

R

RD

Hi all,

Anyone know how to figure out *where* an error is being generated from?

I have a function that returns a string. The string will contain the user name
or "False" if the user name isn't in the table or "Empty" if the table doesn't
have any user names (I try to cover all my bases), or, if an error occurs, the
error number. Well, through some fat fingered coding I managed to generate a
runtime error. When I Err.Raise using that number and return it's description I
get "3061: Application-defined or object-defined error" but when I print the
original error to the debug window I get "3061: Too few parameters. Expected 1."

So, it's not from the VBA error object. Where is it coming from? Access? DAO?
There's gotta be a way to ID who is generating the error.

Eons ago I downloaded some code to make a table of VBA error codes and
descriptions and it's been helpful to me over the years. Anyone know of a
similar function to return AccessError and DAO error codes?

I fixed my botched code but I would like to return an accurate description of
runtime errors in the future.

Thanks for any help,
RD
 
R

RD

Hi all,

Anyone know how to figure out *where* an error is being generated from?

I have a function that returns a string. The string will contain the user name
or "False" if the user name isn't in the table or "Empty" if the table doesn't
have any user names (I try to cover all my bases), or, if an error occurs, the
error number. Well, through some fat fingered coding I managed to generate a
runtime error. When I Err.Raise using that number and return it's description I
get "3061: Application-defined or object-defined error" but when I print the
original error to the debug window I get "3061: Too few parameters. Expected 1."

So, it's not from the VBA error object. Where is it coming from? Access? DAO?
There's gotta be a way to ID who is generating the error.

Eons ago I downloaded some code to make a table of VBA error codes and
descriptions and it's been helpful to me over the years. Anyone know of a
similar function to return AccessError and DAO error codes?

I fixed my botched code but I would like to return an accurate description of
runtime errors in the future.

Thanks for any help,
RD

Well, I found one for Access and Jet errors. That's where my original 3061
error came from. Now I just need to find one for the DAO error object.

If anyone is interested in the functions to produce tables with either the VBA
or Access/Jet error codes let me know and I'll post them.

Regards,
RD
 
R

RD

Well, I found one for Access and Jet errors. That's where my original 3061
error came from. Now I just need to find one for the DAO error object.

If anyone is interested in the functions to produce tables with either the VBA
or Access/Jet error codes let me know and I'll post them.

Regards,
RD

Ok ... looks like the DAO Errors collection is just a container for the errors
that occur. The properties are Source, Number and Description. I'm guessing
I'm going to need to use DAO errors to determine what library caused the error
so I can Raise the right error code? I think this fish is getting too big to
fry.
 
T

Tim Ferguson

"3061: Too few parameters. Expected 1."

This practically always means there is a spelling error in the query. Check
table and field names very precisely, make sure any reserved words are
covered in [brackets] etc. Another possibility is a string value not
delimited in quotes (WHERE LastName = Evans).

Unless, of course, it is meant to be a parameter query and you haven't
passed in the value of the parameter...

HTH


Tim F
 
T

Tom

I'm interested...

Well, I found one for Access and Jet errors. That's where my original 3061
error came from. Now I just need to find one for the DAO error object.

If anyone is interested in the functions to produce tables with either the VBA
or Access/Jet error codes let me know and I'll post them.

Regards,
RD
 

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