By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
425,863 Members | 838 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 425,863 IT Pros & Developers. It's quick & easy.

Access Update query not running in VBA but runs manually

P: 3
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
  3.  
  4. Function updateShftDate()
  5.  
  6. On Error GoTo Macro6_Err
  7. DoCmd.SetWarnings False
  8. DoCmd.OpenQuery "qryShiftDate", acViewNormal, acEdit
  9.  
  10. Macro6_Exit:
  11. Exit Function
  12.  
  13. Macro6_Err:
  14. MsgBox Error$
  15. Resume Macro6_Exit
  16. DoCmd.SetWarnings False
  17.  
  18. End Function
  19.  
I've also tried replacing the
Expand|Select|Wrap|Line Numbers
  1. DoCmd.OpenQuery
with
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
Share this question for a faster answer!
Share on Google+

Post your reply

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