DoCmd.RunSQL Question

  • Thread starter Thread starter Rob Wiltbank
  • Start date Start date
R

Rob Wiltbank

I have a form which I am validating and manipulating using VBA. I have an
unbound control that's setup to store a short date, however, the table to
which the form is linked to, that value can be null.

I build the SQL query and execute with doCmd.RunSQL -- I first get the
message confirming the append and, if the value of that DOB is null, an
error "Microsoft Office Access can't append all the records in the append
query."

My question: Are you able to bypass the confirmation and append error?
 
If the question is: Can we run this code without having the error messages
displayed, the answer is Yes. Just bracket it with SetWarning commands:

DoCmd.SetWarnings False
DoCmd.RunSQL ...
DoCmd.SetWarnings True

If the question is will the record be appended, the answer is No. You won't
see the error messages, but the record won't be appended either. There is
no way to over-ride the built-in data and referential integrity rules.

You are going to have to change your process for appending the record, but
since you didn't show how you're doing it now, I can't say.
 
It's actually appending fine since it's not violating any of the back-end DB
data rules... it can be null, so this is a good solution.

Thanks for the info,

R.
 
Back
Top