Senin, 01 September 2014

Re: [MS_AccessPros] On click vba code to close multiple quarries

 

Dear kenaf42 (name?)-


In an Access application, you should never have a query open in the user interface.  When you give users a query result in a datasheet, you have no control over what the user does with the data.  You can't for example, prevent them from updating certain fields, deleting data that shouldn't be deleted, or inserting invalid data.  You can help keep data clean using Validation Rules in your Tables, but you don't have any control beyond that.

It's for these reasons that we always recommend you use a form (which can be bound to a query) to present information to users.  In a form, you have a whole host of events that you can use to both validate data and automate your application.

If you really need to close open queries, take a look at the code here:


That shows you how to loop through the AllQueries collection and detect open queries.  It's a simple matter to add a line to close any that you find open.

John Viescas, Author
Microsoft Access 2010 Inside Out
Microsoft Access 2007 Inside Out
Microsoft Access 2003 Inside Out
Building Microsoft Access Applications 
SQL Queries for Mere Mortals 
(Paris, France)




On Sep 1, 2014, at 12:48 AM, kenaf42@yahoo.com [MS_Access_Professionals] <MS_Access_Professionals@yahoogroups.com> wrote:

Access 07; is there code for closing several open quarries at same time? If yes, I would appreciate to receive it. I am using micro with several lines to achieve this task then I thought there must be better technique to do this using vba.



__._,_.___

Posted by: John Viescas <johnv@msn.com>
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (2)

.

__,_._,___

Tidak ada komentar:

Posting Komentar