Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access VBA
|
Access VBA Discuss using VBA for Access programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old August 18th, 2009, 01:28 PM
Registered User
 
Join Date: Aug 2009
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Determin Rows Updated By Access Query

I'm wondering if there is a way to determine how many rows were updated by a query I run using VBA. Some background. When a user clicks a button on a form an update query is run. If no rows were updated I want to stop the rest of the code from executing. In order to do this I need to determine how many rows were updated. Ideas?
 
Old August 24th, 2009, 04:09 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,151
Thanks: 2
Thanked 14 Times in 14 Posts
Send a message via ICQ to SerranoG Send a message via AIM to SerranoG
Default

Well, one way is to have a field in the table that has the date and time that record was last updated. You could find the latest one by using the DMax function and save that value in a variable. Then you would run your update query as usual making sure to store new values for the update date and time. Next, check the table again to see how many records have an update date and time greater than the variable you first stored.
__________________
Greg Serrano
Michigan Dept. of Environmental Quality
Air Quality Division
 
Old August 24th, 2009, 04:10 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,151
Thanks: 2
Thanked 14 Times in 14 Posts
Send a message via ICQ to SerranoG Send a message via AIM to SerranoG
Default

Oh, almost forgot... use the DCount function to get that number I mentioned.
__________________
Greg Serrano
Michigan Dept. of Environmental Quality
Air Quality Division
 
Old August 26th, 2009, 11:57 PM
Registered User
 
Join Date: Aug 2009
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks for the feedback. I wasn't aware of that function. I'll give a go tomorrow and see if that doesn't solve the problem I was having. Thanks Again.


















1





Similar Threads
Thread Thread Starter Forum Replies Last Post
strongly-typed DataSet.Rows r n't getting Updated srkvellanki ASP.NET 2.0 Professional 3 October 1st, 2008 05:26 PM
Query on million of rows wkm1925 SQL Server 2000 6 October 23rd, 2006 09:30 AM
How to check whether query retuns some rows or not kumar_raj13 ASP.NET 1.0 and 1.1 Professional 1 March 13th, 2006 12:59 AM
getting a query rows as columns raamts SQL Language 1 February 24th, 2005 04:06 AM
Updated from Access to SQL - Some problems TaoEntropy BOOK: Beginning ASP 3.0 6 March 10th, 2004 06:28 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.