Solved

Executing SQL on a Form's Recordset

Posted on 2011-09-14
4
335 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
Comment Utility
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
Comment Utility
Nice.  I think I see why that works.  Should have considered that.  Thanks a lot!

Mike
0
 
LVL 61

Expert Comment

by:mbizup
Comment Utility
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
Comment Utility
Indeed.  Makes sense.
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

I originally created this report in Crystal Reports 2008 where there is an option to underlay sections. I initially came across the problem in Access Reports where I was unable to run my border lines down through the entire page as I was using the P…
Introduction The Visual Basic for Applications (VBA) language is at the heart of every application that you write. It is your key to taking Access beyond the world of wizards into a world where anything is possible. This article introduces you to…
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

762 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now