Trapping Error 3101

B

Barry

Hi:
I have a form with 2 dependant combos to select a CategoryID and PartID. I
would like to check to make sure that both are selected before trying to
leave the record. When I put some code in the BeforeUpdate and/or Current
event of the form, I get an error "The Microsoft Jet database enfine cannot
find a record in the table <name> with matching key". Help shows error 3101
but, when I try to check err.number, it says 0. Where and/or how should I be
checking to trap this error. I look forward to some help.
Thanks,
Barry
 
A

Allen Browne

It's probably the form's Error event that's triggering the message.

As for how to solve it, you'll want to to do several things, including
ensuring Name AutoCorrect is off, decompiling, compact/repair (in case it's
a bad index), checking references, and compiling.

Follow the steps in this standard recovery sequence:
http://allenbrowne.com/recover.html
 
B

Barry

Allen:
Thanks for the response. However, I'm confused again, or still. I would
have expected to see and error because you tried to leave the record before
the key field(s) contain a value. The PartCategoryID and PartID are both
part of the primary key of the OrderDetails table (along with the
OrderDetailsID). Other fields in the table are Qty, Cost etc. I am just
wondering if the error I am getting can be trapped so that I may use a custom
error message rather than the Access generated message. I hope that I have
explained sufficiently.
Thanks again,
Barry
 
B

Barry

Allen:
Indeed I did. Perhaps I am not properly turning off the Access error
messages. The Form_Error gets triggered and it appears that the err.number =
0. So, I tried to DoCmd.SetWarnings False and set Cancel = True however,
after running through the code the error message still appears. The Microsoft
Jet database engine ... What's next boss?
Thanks,
Barry
 
B

Barry

Ah ha! I had a eureka. Response = acDataErrContinue stops the error
message. Silly of me. I must be having OldTimers disease.
Thanks for all the help.
Sincerely,
Barry
 

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