Solved

Executing SQL on a Form's Recordset

Posted on 2011-09-14
4
364 Views
Last Modified: 2013-11-28
I have a form with a procedure that updates all records in the data set.  Using SQL is the most efficient way to do this (rather than looping through the form's recordset).  But if I use CurrentDb.Execute strSQL, the form barks at me about another user altering the recordset.  Is there a way to run the SQL within the scope of the form?  Perhaps a DAO or ADO command?

Mike
0
Comment
Question by:shacho
  • 2
  • 2
4 Comments
 
LVL 61

Accepted Solution

by:
mbizup earned 500 total points
ID: 36540280
Mike,

Try saving the data on the form immediately before the CurrentDb.Execute strSQL statement.

To do this, you can use the following:
    docmd.RunCommand acCmdSaveRecord


0
 

Author Comment

by:shacho
ID: 36540283
Nice.  I think I see why that works.  Should have considered that.  Thanks a lot!

Mike
0
 
LVL 61

Expert Comment

by:mbizup
ID: 36540295
That is the solution for a lot of similar issues... basically you want any data that is in the process of being edited to either be "undone" or fully committed to the table before beginning any seperate editing or saving process.  Otherwise, even if it is just the actions of one user, it has the net effect of multiple people stepping on each other's toes.
0
 

Author Comment

by:shacho
ID: 36540300
Indeed.  Makes sense.
0

Featured Post

Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

QuickBooks® has a great invoice interface that we were happy with for a while but that changed in 2001 through no fault of Intuit®. Our industry's unit names are dictated by RUS: the Rural Utilities Services division of USDA. Contracts contain un…
Overview: This article:       (a) explains one principle method to cross-reference invoice items in Quickbooks®       (b) explores the reasons one might need to cross-reference invoice items       (c) provides a sample process for creating a M…
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question