473,614 Members | 2,351 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to ensure the right number of records gets updated

3 New Member
Hello,

I have MS Access form that basically allows the user to configure an update statement to a single table via the gui. A requirement is to show the count of records that will be updated prior to the actual update.
I'm planning on showing a message box with yes / no buttons that will basically show the selection and update criteria in a user friendly fashion, show the # of records that will be updated and ask if they are sure they want to commit these changes.

I'm trying to ensure the # of records expected to get updates is actually the number that gets updated. This is an OLTP system and other user may be making updates via other processes, apps etc.

I'm looking for a little advice on how to handle this. One of my problems is that the sp that updates the db is already written & encrypted and i can't see it. It handles audit trail stuff as well. It also returns a modification id as a resultset so when i interrogate the RecordsAffected from ADO.execute i always get -1 so i don't think i can get that since it returns a result set.

This is what i was thinking of doing. Initially just get a count of records prior to showing the confirmation msgbox & by running a select query (no transacton yet - i need to minimize locking on db - so cant lock records while showing the msgbox) and save count in ExpectedRecCnt variable. Then if user doesnt cancel i thought i could BEGIN TRANSACTION then run the select statement again (but this time lock the records somehow - WITH UPDATE LOCK hint or something - sound right?) then check that count against my ExpectedRecCnt variable to make sure they match - if not error msg rollback tran. If they match run the actual upate statement - if succesful commit trans, if failure rollback trans.

Does thi sound like a solid plan?
If not any advice on a better way to handle it would be greatly appreciated.

Thanks!
Sep 13 '07 #1
0 1163

Sign in to post your reply or Sign up for a free account.

Similar topics

6
8391
by: John R | last post by:
Hi all, I'm trying to get my VB6 app to look up prefixes for a phone number out of an MDB file along with an associated price etc. For example the phone number could be 9802xxxx, and the MDB file will have the record 9802 with an associated price. I am used to connecting to databases via ADO, but my problem is that the MDB file may contain prefixes from 1 to 5 chars in length and i'm not sure how
10
2023
by: Paul Kooistra | last post by:
I need a tool to browse text files with a size of 10-20 Mb. These files have a fixed record length of 800 bytes (CR/LF), and containt records used to create printed pages by an external company. Each line (record) contains an 2-character identifier, like 'A0' or 'C1'. The identifier identifies the record format for the line, thereby allowing different record formats to be used in a textfile. For example: An A0 record may consist of:
6
4032
by: PG | last post by:
When deleting a row from the database, that id is now missing. So what I'm trying to do is update in a loop (maybe an sql loop if there is one) of all of the id numbers - sort of like renaming them. It did partly work because all the id's were set to 22. Thats because there was 22 rows. Here's the code I used: $result = mysql_query ("SELECT * FROM counter"); for($counting = 1; $row = mysql_fetch_row ($result); ++$counting)
0
1795
by: Scott269 | last post by:
So I've got an old MS Works database I imported into Access. I needed a primary key so I created a record number field that was just the record number I manually inserted when I entered it in the database so I could sort the records by the date at which they were entered. Well now I've deleted some of those records so its of course causing gaps in the records. The record number in Access no longer matches my record number that I...
1
5412
by: Scott269 | last post by:
So I've got an old MS Works database I imported into Access. I needed a primary key so I created a record number field that was just the record number I manually inserted when I entered it in the database so I could sort the records by the date at which they were entered. Well now I've deleted some of those records so its of course causing gaps in the records. The record number in Access no longer matches my record number that I...
4
1051
by: Simon Harris | last post by:
Hi All, I'm new to ASP.Net. As I understand it, the code and presentation should as much as possible remain seperate. Code is in the 'codebehind' - Be it a script block at the top of the page or seperate file. I have a situation where I need to list the number of related records. So far, I have a datalist, which displays records along with an indicator of
16
10112
by: usenet | last post by:
I want to be able to use the record numbers of a sub-form, are they available anyhow in VB (Access 2003)? I want to use the sub-form record number as *part* of the primary key for the table whose data is displayed on the sub-form. The other part of the primary key is the column used to join to the master table. E.g. I have TableA (the master table) with a primary key TableA.Column1. TableB which is shown in the sub-form has a primary...
8
4594
by: thefj | last post by:
Hey all, As part of an access application, I am importing data from an XML file into a table, then using an update query to process the imported data into various other tables in the database where it belongs. I have the queries running fine, but I cannot for the life of me find out how to, from a VB code perspective, get the number of records that will be updated (or were updated) by a query. I'm trying to make something similar to the...
2
2428
by: =?Utf-8?B?UHJpeWE=?= | last post by:
Hi, I'm faced with a classic problem of how to update a large number of records from a web page. I;m trying to build an interface that will display recordset in the order of 3000 rows and allow the user to edit and update records from that interface. I have cached some static lists in the page but the main recordset should reflect updated data so it can't be cached. I also compute some control functions over the whole data. This will...
0
8197
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8640
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8443
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6093
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4058
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4136
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2573
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1757
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1438
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.