473,396 Members | 1,714 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,396 software developers and data experts.

Numbering duplicate StockCodes

I have a query with the following fields: StockCode, Description, Supplier, SupCatalogueNum.
A stockcode can be purchased from more than one supplier. How do I number the suppliers from 1 to 5 on the same stock code

Exp: StockCode: 020-01250-0120016
Supplier: ALE003
Supplier: NJR001
Supplier: STA002

I need to add colum with Supplier No:
Supplier No
ALE003 1
NJR001 2
STA002 3
Jul 27 '16 #1
6 862
PhilOfWalton
1,430 Expert 1GB
I suspect your database is not normalised

You should have a table of Suppliers and a table of StockCodes.
The Foreign Key in the table of StockCodes points to the Supplier

Phil
Jul 27 '16 #2
nico5038
3,080 Expert 2GB
The sequence number is indeed not normalized and can be calculated by counting the n'th record for a stock code.
For this a DCOUNT("supplier","tblStock", "[stockcode] = '" [stockcode] & "' and Supplier<='" [Supplier] & "'") can be used to count the number of suppliers within the stock item with the same or lower suppliercode. It will however costs a lot of processing time (it's in general slooooow).

Nic;o)
Jul 27 '16 #3
My query result looks like this
StockCode Description Supplier SupCatalogueNum
020-01250-0120016 Sht MS CR 2.5x1.2mx1.6mm ALE003 10018500
020-01250-0120016 Sht MS CR 2.5x1.2mx1.6mm NJR001
020-01250-0120016 Sht MS CR 2.5x1.2mx1.6mm STA002 RCR2450122516
020-01250-0120016 Sht MS CR 2.5x1.2mx1.6mm STE003 C/R 2500x1200
020-01250-0120020 Sht MS CR 2.5x1.2mx2.0mm ALE003 10018508
020-01250-0120020 Sht MS CR 2.5x1.2mx2.0mm KAR001 EC & WHITE POW COUT
020-01250-0120020 Sht MS CR 2.5x1.2mx2.0mm NJR001 SCR02012252450
020-01250-0120020 Sht MS CR 2.5x1.2mx2.0mm STA002 RSCR245012252.0
020-01250-0120020 Sht MS CR 2.5x1.2mx2.0mm STE003 C/R 2500x1200

I need a Number colum numberbing the suppliers per stockcode.
Jul 28 '16 #4
nico5038
3,080 Expert 2GB
By adding a DCOUNT() function (see above) in a column of the select statement you can create this number dynmically. Just try !

Nic;o)
Jul 28 '16 #5
Thanks nico5038...I managed to come right with the increment function. :-) kcludick1001
Jul 28 '16 #6
nico5038
3,080 Expert 2GB
Well done ! It will be slow and when you use a report you can add a field with a +1 function to achieve the same result.

Nic;o)
Jul 28 '16 #7

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

Similar topics

2
by: Andy Glew | last post by:
I have long looked for (and occasionally posted questions to groups such as this about) a tool that can take a group of HTML pages (nowadays XHTML, or XML) and produce a nicely formatted...
6
by: Stanimir Stamenkov | last post by:
So if the 'type' attribute of the OL element is deprecated and authors should rely only on stylesheets how one could use a reference (as clear text) in the content to a particular list element? ...
6
by: Christian Roth | last post by:
Hello, how do I offset the numbering of a list in XHTML Strict (+CSS) in current browsers? What I want is something like: 5. Item a 6. Item b 7. Item c
5
by: Charles McCaffery | last post by:
I have written a database with auto-numbering and now wish to remove alkl of my test data and set the auto-numbering back to one. How do I do this please? Charles McCaffery.
1
by: Wayne Aprato | last post by:
I have a report that shows the results of a query. One of the fields is an autonumber field from the query which shows for instance: 120, 121 , 122 for 3 records. Is there a way to have another...
2
by: Wayne Aprato | last post by:
I posted this yesterday and it seems like a moderator has thrown it in another thread. This is a totally different question to the one asked in that thread, so I'm posting it again. It is not a...
3
by: Jim Bancroft | last post by:
Hi all, In VB6 I used a 3rd party tool for line numbering my source code, to help with debugging. However, in experimenting with VB .Net I've noticed that my exceptions automatically provide...
8
by: zandiago | last post by:
Good day: My assignment is as follows: " Use a one-dimensional array to solve the following problem. Read in 1000 numbers, each of which is between 10 and 100, inclusive. As each number is...
0
by: Taiseer Hussein | last post by:
Hi, I have a project to combine multiple word doc in single one. I was able to combine them successfully using copy & paste, however I'm having two issues 1. I wanted to keep the original format,...
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
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,...
0
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...
0
jinu1996
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...
0
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...
0
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,...

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.