473,786 Members | 2,737 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Update Query

Anyone able to help?

I want to update a specified number of records that match a criteria. If I
use an update query it alters all the records that match - I need to alter
only a variable number. Is there a way to do this?

Specifically:

I have a list of available serial numbers that will satisfy an order. Some
of those will have been previously allocated to another order, those that
have not, have 0 in a field called Allocate_To the ones that have been
allocated have an order ID in that field.
I have then a new order to allocate for a qty of (say) 10 and I therefore
need to insert the relevant order ID into 10 records.
An Update query allocates the order ID to all records where Allocate_To = 0.
How do I restrict this action to the specified number?

Hope this makes sense

TIA

Clive Moss
Nov 12 '05 #1
3 8394
Clive,

In your Update query set the Allocate_to field criteria to 0. Click anywhere in
the window that displays the objects your query is based on. A popup menu will
appear, go to the Top property and enter 10. When you run the query, the first
10 records where Allocate_To is 0 will be updated.
--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
www.pcdatasheet.com
"Clive Moss" <cl***@REMOVEin stant-image.co.uk> wrote in message
news:%O******** *************@n ews-text.cableinet. net...
Anyone able to help?

I want to update a specified number of records that match a criteria. If I
use an update query it alters all the records that match - I need to alter
only a variable number. Is there a way to do this?

Specifically:

I have a list of available serial numbers that will satisfy an order. Some
of those will have been previously allocated to another order, those that
have not, have 0 in a field called Allocate_To the ones that have been
allocated have an order ID in that field.
I have then a new order to allocate for a qty of (say) 10 and I therefore
need to insert the relevant order ID into 10 records.
An Update query allocates the order ID to all records where Allocate_To = 0.
How do I restrict this action to the specified number?

Hope this makes sense

TIA

Clive Moss

Nov 12 '05 #2
Thanks for prompt reply - I should have said that I am trying to do this
from a procedure fired by an OnClick action

Clive

"PC Datasheet" <sp**@nospam.co m> wrote in message
news:%b******** **********@news read1.news.atl. earthlink.net.. .
Clive,

In your Update query set the Allocate_to field criteria to 0. Click anywhere in the window that displays the objects your query is based on. A popup menu will appear, go to the Top property and enter 10. When you run the query, the first 10 records where Allocate_To is 0 will be updated.
--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
www.pcdatasheet.com
"Clive Moss" <cl***@REMOVEin stant-image.co.uk> wrote in message
news:%O******** *************@n ews-text.cableinet. net...
Anyone able to help?

I want to update a specified number of records that match a criteria. If I use an update query it alters all the records that match - I need to alter only a variable number. Is there a way to do this?

Specifically:

I have a list of available serial numbers that will satisfy an order. Some of those will have been previously allocated to another order, those that have not, have 0 in a field called Allocate_To the ones that have been
allocated have an order ID in that field.
I have then a new order to allocate for a qty of (say) 10 and I therefore need to insert the relevant order ID into 10 records.
An Update query allocates the order ID to all records where Allocate_To = 0. How do I restrict this action to the specified number?

Hope this makes sense

TIA

Clive Moss


Nov 12 '05 #3
I'm Not sure what you are meaning by your response but you can run the Update
query in the OnClick event with the code:
DoCmd.SetWarnin gs False
DoCmd.OpenQuery "NameOfYourUpda teQuery"
DoCmd.SetWarnin gs True

Steve
PC Datasheet
"Clive Moss" <cl***@REMOVEin stant-image.co.uk> wrote in message
news:pJ******** *************@n ews-text.cableinet. net...
Thanks for prompt reply - I should have said that I am trying to do this
from a procedure fired by an OnClick action

Clive

"PC Datasheet" <sp**@nospam.co m> wrote in message
news:%b******** **********@news read1.news.atl. earthlink.net.. .
Clive,

In your Update query set the Allocate_to field criteria to 0. Click

anywhere in
the window that displays the objects your query is based on. A popup menu

will
appear, go to the Top property and enter 10. When you run the query, the

first
10 records where Allocate_To is 0 will be updated.
--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
www.pcdatasheet.com
"Clive Moss" <cl***@REMOVEin stant-image.co.uk> wrote in message
news:%O******** *************@n ews-text.cableinet. net...
Anyone able to help?

I want to update a specified number of records that match a criteria. If I use an update query it alters all the records that match - I need to alter only a variable number. Is there a way to do this?

Specifically:

I have a list of available serial numbers that will satisfy an order. Some of those will have been previously allocated to another order, those that have not, have 0 in a field called Allocate_To the ones that have been
allocated have an order ID in that field.
I have then a new order to allocate for a qty of (say) 10 and I therefore need to insert the relevant order ID into 10 records.
An Update query allocates the order ID to all records where Allocate_To = 0. How do I restrict this action to the specified number?

Hope this makes sense

TIA

Clive Moss



Nov 12 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
10238
by: Surendra | last post by:
I have this query that I need to use in an Update statement to populate a field in the table by the value of Sq ---------------------------------------------------------------------------- Inline View Query: Select Sq from ( Select substr(to_date(End_Date,"DD-MON-YYYY"),4), End_Date, Rank() Over (Partition by substr(to_date(End_Date,"DD-MON-YYYY"),4) Order by End_Date) As Sq
2
8542
by: Mike Leahy | last post by:
Hello all, This question is related to updating tables - is there any way to calculate or update the values in a column in a table to the values in a field produced by a query result? An example of what I'm trying to do is below: update (tbl_ind_mananas LEFT JOIN (select count(*) as count, (dubicacion || zona || manzana) as cod_manzana from tbl_censo_poblacion_1993 group by dubicacion, zona, manzana) tbl1 on relacion = cod_manzana) as...
10
3281
by: Randy Harris | last post by:
I imported records into a table, later found out that many of them had trailing spaces in one of the fields. If I'd caught it sooner, I could have trimmed the spaces before the import. This wouldn't work (nothing changed): UPDATE tblManuals SET tblManuals.PARTNUM = Trim(); Would someone please tell me how to do an update query that will trim the spaces?
4
11341
by: deko | last post by:
I'm trying to update the address record of an existing record in my mdb with values from another existing record in the same table. In pseudo code it might look like this: UPDATE tblAddress SET AddressDescription of Entity 456 = AddressDescription of Entity_ID 123 Address1 of Entity 456 = Address1 of Entity_ID 123 City of Entity 456 = City of Entity_ID 123
8
3725
by: Maxi | last post by:
There is a lotto system which picks 21 numbers every day out of 80 numbers. I have a table (name:Lotto) with 22 fields (name:Date,P1,P2....P21) Here is the structure and sample data: "Date","P1","P2","P3","P4","P5","P6","P7","P8","P9","P10","P11","P12","P13","P14","P15","P16","P17","P18","P19","P20","P21" 1/1/2005,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21 1/2/2005,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22
7
3540
by: Mark Carlyle via AccessMonster.com | last post by:
I have this update query that I am trying to run. I know the syntax is messed up but do not know how to correct it. Select 'UPDATE', Transactions,'Set = where = ' From "Get Daily Balances" Transactions = name of the table I want to update balance = name of the field i want to update daily balance= name of the query result that I want to move to the table
3
3451
by: Shapper | last post by:
Hello, I have created 3 functions to insert, update and delete an Access database record. The Insert and the Delete code are working fine. The update is not. I checked and my database has all the necessary records in it when testing it. I get the error "No value given for one or more required parameters." when I try to update the database. Can you tell me what am I doing wrong?
31
2455
by: Lag | last post by:
Having a problem updating my database from a web page, through a submission form. Can anyone help? ----THIS IS MY CODE IN update.php----(user, pass, and database are typed in directly, I changed them here for securiy reasons :) ) <?php /*---CONNECT TO DATABASE---*/
3
2682
by: eholz1 | last post by:
Hello PHP programmers. I had a brilliant idea on one of my pages that selects some data from my mysql database. I first set the page up to display some info and an image, just one item, with a row of data, etc. then I thought it would be nice to do a select, and perhaps an update (the title of the image) on the same page.
16
3520
by: ARC | last post by:
Hello all, So I'm knee deep in this import utility program, and am coming up with all sorts of "gotcha's!". 1st off. On a "Find Duplicates Query", does anyone have a good solution for renaming the duplicate records? My thinking was to take the results of the duplicate query, and somehow have it number each line where there is a duplicate (tried a groups query, but "count" won't work), then do an update query to change the duplicate to...
0
9647
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
9496
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10363
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
9961
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...
0
8989
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7512
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
5397
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...
1
4066
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
3
2894
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.