Trapping Error 3101

  • Thread starter Thread starter Barry
  • Start date Start date
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
 
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
 
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
 
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
 
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
 
Back
Top