datatable - Form button to Save Record Clashing with Table Validation -


i have form intended data entry, , button (should) save record data table (ie goes next blank record) message box appearing saying "your record has been saved successfully".

however, have mandatory fields on form, validation set in data table 'is not null' able define error messages appear. causes, on 'save record' button click, 1st: messagebox appearing telling me has saved successfully, followed validation error message set in data table, followed "you can't go specified record", followed macro single step window prompting me 'stop macros' how can macro stop running if validation rule (set in data table) fails? - i'd assume go on first event of macro builder?

thanks provided!

you this, use code event procedure button.

private sub cmdsaverecord_click()      ' try save record, skip error     on error resume next     docmd.runcommand accmdsaverecord     ' if not successful, display error , exit     if err.number <> 0         ' err.description contains field validation rule message         msgbox err.description, vbexclamation, "error on saving"         exit sub     end if      on error goto 0      msgbox "your record has been saved successfully", vbinformation     ' new record     docmd.gotorecord acactivedataobject, , acnewrec     ' goto first control on new record, instead of cmdsaverecord     me.text1.setfocus  end sub 

Comments

Popular posts from this blog

account - Script error login visual studio DefaultLogin_PCore.js -

xcode - CocoaPod Storyboard error: -