Hi
This is the second query I have had with Dmax. The first one I resolved as it was in a form and by using DMAX everytime I click for new record it gave a new order number ie dmax("ordernumb er", "tbl_orders")+1 .
This problem is quite different and I am hoping someone out there can advice.
I have a group of orders in a table. I tick a box to select which records I want to batch for that particular month. An update query then copies these records to a new table ready for batching.
My query is that each row needs to have a unique reference number. I cant use autonumber as I must specify the first number at the beginning. After that each record will increment by one.
Thanks for your help. Hope all this makes sense
jacc14
4 4590
Hi
This is the second query I have had with Dmax. The first one I resolved as it was in a form and by using DMAX everytime I click for new record it gave a new order number ie dmax("ordernumb er", "tbl_orders")+1 .
This problem is quite different and I am hoping someone out there can advice.
I have a group of orders in a table. I tick a box to select which records I want to batch for that particular month. An update query then copies these records to a new table ready for batching.
My query is that each row needs to have a unique reference number. I cant use autonumber as I must specify the first number at the beginning. After that each record will increment by one.
Thanks for your help. Hope all this makes sense
jacc14
As long as ordernumber is unique, you can use DCount to generate number sequence in your query as shown below: Don't forget to add the other fields besides Sequence and ordernumber to your query
SELECT DCount("ordernu mber", "tbl_orders","o rdernumber <=" & [ordernumber]) AS Sequence, ordernumber
FROM tbl_orders
ORDER BY tbl_orders.orde rnumber;
Hi there
Just had a go and understand how it works. Problem is that I am only selecting random records from the tbl_orders. As I dont want the first record the sequence is starting at number 2 . If I dont select the 4th record then the sequence is 1 , 2 , 3 , 5 and so on.
Hope this makes sense. Its as if I need to assign a unique number once the selected data has been transfered to the result table rather than before.
Thanks for your help
Hi there
Just had a go and understand how it works. Problem is that I am only selecting random records from the tbl_orders. As I dont want the first record the sequence is starting at number 2 . If I dont select the 4th record then the sequence is 1 , 2 , 3 , 5 and so on.
Hope this makes sense. Its as if I need to assign a unique number once the selected data has been transfered to the result table rather than before.
Thanks for your help
Ok, you are correct. I did not realize you were picking random records. But, you can do the same thing with a text field as long as it is unique within the query. For example, if customerName is unique within the query.
SELECT DCount("custome rName ", "tbl_orders "," customerName <=’” & [customerName] & "'") AS Sequence, ordernumber, customerName
FROM tbl_orders
ORDER BY tbl_orders. customerName;
Thanks for your help
There was no unique record as there are sometimes more orders for one customer.
I have now solved this by running an additional select query from the result table and putting in your original suggest Dcount and sequence method.
Finally got there in the end.
Many thanks
jacc14
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Apple |
last post by:
May anyone can teach me how to assign a autonumber, I want to create a
number that is starting with year(auto change to year 2006) +
autonumber (eg. 2005-0001, 2005-0002)
|
by: Apple |
last post by:
May anyone can teach me to assign a autonumber, I want to create a
number that is starting with year (auto change to year 2006) +
autonumber (eg. 2005-1001, 2005-1002 and so on)
|
by: Apple |
last post by:
Is there anyone can help me to solve this problem? Thank!
|
by: Apple |
last post by:
1. I want to create an autonumber, my requirement is : 2005/0001
(Year/autonumber), which year & autonumber no. both can auto run.
2. I had create a query by making relation to a table & query, but I
can't update record in query or in form. I believe the problem is due
to the source query.
In source query, there is a filter to show the incomplete record
("is null" in delivery date)], but I need to re-use the job no. if the
job is...
|
by: dskillingstad |
last post by:
I have a form with one textbox (PermitNumber) where the default value
is:
=IIf(DatePart("yyyy",Date())=Left(DMax("PermitNumber","tblBLPermitMain"),4),DMax("PermitNumber","tblBLPermitMain")+1,nextBldgPermit()).
I also have a module (nextBldgPermit() that has the following code:
Function nextBldgPermit()
nextBldgPermit = DatePart("yyyy", Date)
| |
by: junkaccount |
last post by:
Hello,
I currently have a field named QuoteNumber in a table named Quotes.
The field is set as autonumber and is used to assign sequential numbers
as users enter information in the table through a form. This number is
mainly used later as reference when a customer calls our office with
questions. We use the quote number to retrieve their related
information through a query. This QuoteNumber field is NOT a primary
key. It is not...
|
by: Alan Mailer |
last post by:
A project I'm working on is going to use VB6 as a front end. The back
end is going to be pre-existing MS Access 2002 database tables which
already have records in them *but do not have any AutoNumber* fields
in them.
Correct me if I'm wrong, but I'm assuming this means that I cannot now
alter these existing Access tables and change their primary key to an
"AutoNumber" type.
If I'm right about this, I need some suggestions as to the...
|
by: luanhoxung |
last post by:
hi all!
i want to create group text for showing my invoice number.
the invoice no. is created by 3 parts.
1st part: autonumber increasing at each new record.
2nd part: 2 characters of current month.
3rd part: 1 character of current year.
Ex: 001-016 --invoice 001 of Jan 2006.
i created 3 unbound control to make 3 parts.
and 1 bound control(inv no.) will be get value from 3 unbound control.
i don't know how can i execute in defaul value...
|
by: Ron |
last post by:
Hi All,
Okay, here's the deal: Access2000/WinXP. Have a database that's split,
FE/BE with multiple users having FE and one of those users also has BE
(still split though...). Have a form on FE for adding/editing transactions.
Using TransactionID control as autonumber/primary key for tblTransactions.
A while back, when I mentioned here that I was showing that control to my
users as the transaction number, someone (can't remember who...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
| |
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...
|
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...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
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...
|
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
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
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...
| |