Senin, 19 Desember 2016

Re: [MS_AccessPros] Delete Records

 

Bill-


The Execute method works on any database object.  CurrentDb points to the current database, so the Execute method asks the current database to run the "action" query.

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




On Dec 19, 2016, at 11:25 PM, 'Bill Singer' Bill.Singer@at-group.net [MS_Access_Professionals] <MS_Access_Professionals@yahoogroups.com> wrote:



Thank you John.
 
What does the  "CurrentDb.Execute"   phrase do that makes the statement work?
 
Bill
 
 
From: MS_Access_Professionals@yahoogroups.com [mailto:MS_Access_Professionals@yahoogroups.com] 
Sent: Saturday, December 17, 2016 4:00 PM
To: MS_Access_Professionals@yahoogroups.com
Subject: Re: [MS_AccessPros] Delete Records
 
  

Bill- 

 
When you want to run an "action" query in code, you need to execute it.
 
CurrentDb.Execute "DELETE * FROM GameShedule", dbFailOnError
 
or 
 
CurrentDb.Execute "DELETE * FROM GameSchedule WHERE fscEveID = 2", dbFailOnError
 
 
John Viescas, Author
Effective SQL
SQL Queries for Mere Mortals 
Microsoft Access 2010 Inside Out
Microsoft Access 2007 Inside Out
Microsoft Access 2003 Inside Out
Building Microsoft Access Applications 
(Paris, France)
 

 

 
On Dec 17, 2016, at 8:03 PM, 'Bill Singer' Bill.Singer@at-group.net [MS_Access_Professionals] <MS_Access_Professionals@yahoogroups.com> wrote:
 


I am trying to create a button that will easily delete all records from a temporary table.
 
 
I have created a delete query but I want to run it from a button.  I can't get the button to see the delete query so I though about some SQL.
 
I have tried.
 
DELETE FROM GameSchedule;
DELETE * FROM GameSchedule;
 
What am I doing wrong?  I keep getting an error message  "Expected End of Statement" with the word "GameSchedule" highlighted.
 
 
 
 
Eventually I want another button that will reduce specific records.
 
DELETE * FROM GameSchedule; 
   WHERE fscEveID = 2
 
 
Thank you,
Bill Singer
MN, 
Heading to 25 below tonight.


 



__._,_.___

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 (6)

Have you tried the highest rated email app?
With 4.5 stars in iTunes, the Yahoo Mail app is the highest rated email app on the market. What are you waiting for? Now you can access all your inboxes (Gmail, Outlook, AOL and more) in one place. Never delete an email again with 1000GB of free cloud storage.


.

__,_._,___

Tidak ada komentar:

Posting Komentar