473,383 Members | 1,792 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

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 8247
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***@REMOVEinstant-image.co.uk> wrote in message
news:%O*********************@news-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.com> wrote in message
news:%b******************@newsread1.news.atl.earth link.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***@REMOVEinstant-image.co.uk> wrote in message
news:%O*********************@news-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.SetWarnings False
DoCmd.OpenQuery "NameOfYourUpdateQuery"
DoCmd.SetWarnings True

Steve
PC Datasheet
"Clive Moss" <cl***@REMOVEinstant-image.co.uk> wrote in message
news:pJ*********************@news-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.com> wrote in message
news:%b******************@newsread1.news.atl.earth link.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***@REMOVEinstant-image.co.uk> wrote in message
news:%O*********************@news-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
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...
2
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...
10
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...
4
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...
8
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: ...
7
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" ...
3
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...
31
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...
3
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...
16
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...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.