469,150 Members | 1,949 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,150 developers. It's quick & easy.

Access Update query not running in VBA but runs manually

This part of code executes after the user logs in in the system in Access.
Expand|Select|Wrap|Line Numbers
  1. Option Compare Database
  2. Option Explicit
  4. Function updateShftDate()
  6. On Error GoTo Macro6_Err
  7. DoCmd.SetWarnings False
  8. DoCmd.OpenQuery "qryShiftDate", acViewNormal, acEdit
  10. Macro6_Exit:
  11. Exit Function
  13. Macro6_Err:
  14. MsgBox Error$
  15. Resume Macro6_Exit
  16. DoCmd.SetWarnings False
  18. End Function
I've also tried replacing the
Expand|Select|Wrap|Line Numbers
  1. DoCmd.OpenQuery
Expand|Select|Wrap|Line Numbers
  1. currentDb.Execute
but is not working either. When I tried to set the
Expand|Select|Wrap|Line Numbers
  1. DoCMd.SetWarning
to TRUE, it pops-up the Warning message saying
Expand|Select|Wrap|Line Numbers
  1. You are about to run an update query that will modify your data in your table
This does not work when called in Access VBA. But this runs when the query is manually ran.
Mar 21 '17 #1
0 614

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

1 post views Thread by Wayne | last post: by
1 post views Thread by New Guy | last post: by
1 post views Thread by csgraham74 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.