471,853 Members | 1,801 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,853 software developers and data experts.

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 695

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 Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.