473,670 Members | 2,495 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to create a unique serial no. based on item selections

14 New Member
How do I create a unique serial number, i.e., TR - "F" for furniture or "M" for Misc, or "V" if Vehicle if selected from a list of categories and a 4-digit serial number for the suffix, to look like this, "TR-F-1004."

TR will not change, only the letter based on the category selected and a 4-digit autonumber field to create a unique label for labeling inventory items.

In the example attached, "55 gallon barrel" was selected, so the
"label number" field populated "TR-55G1035" the 4-digit number comes should come from a auto number field.

Would really appreciate your help on this!

Attached Images
File Type: jpg access example.jpg (58.0 KB, 1528 views)
Oct 9 '14 #1
22 3476
twinnyfo
3,653 Recognized Expert Moderator Specialist
pbsnow,

I am a bit confused. Do you want the 4 digit number to be an AutoNumber or not? If so, then there is no real need to calculate the serial number, as the record itself will have a unique identifier, and you can apply that number to your Serial Number during run time.

However, if this is not the case, but you actually want unique serial numbers for each type of item (e.g.:

Expand|Select|Wrap|Line Numbers
  1. TR-F-0001
  2. TR-F-0002
  3. TR-F-0003
  4. TR-M-0001
  5. TR-M-0002
  6. TR-M-0003
  7. TR-M-0004
  8. TR-V-0001
  9. TR-V-0002
  10. TR-V-0003
Then you would need to query all items of that specific type, find the maximum numeric value, increment it by one, then concatenate the new serial number.

Either option is doable, but you must provide us more information on how you are generating this serial number.

Also, keep in mind that when you limit your serial numbers to four digits, you may ultimately run into problems if you have more than 9,999 entries (depending on the size of your operation).

Lots of different options with this, but, again, we need more information to properly advise.
Oct 9 '14 #2
zmbd
5,501 Recognized Expert Moderator Expert
This topic has been covered many times here at bytes...
Please do a search on this site,
Use the box next to the orange magnifying-glass at the top of the page... enter the search terms:
ms access serial number

The normal advice is to do this in a query using a calculated field and not to store this information:

Allen Browne: Calculated Fields

Calculated Fields MS ACC2003 Although this is for ACC2003 this has not changed in the newer versions.

so in your case in the query...
"TR-" & [catagory_field] & [autonumber_fiel d]

You can get fancier with this and check for null values and other conditions; however, this is the basic method.
Oct 9 '14 #3
twinnyfo
3,653 Recognized Expert Moderator Specialist
@Z,

I think it's earlier where you are....

;-)
Oct 9 '14 #4
pbsnow
14 New Member
Yes, I want something like that, and, the autonumber field does not have to start over with each different item, it can, but whatever is easier.

What I do want, however is, if a person selects, i.e., Barrels as a category, how do I best create the items table so that once they select the barrels category, there are different size barrels, i.e., 55G for 55 Gallon Barrel or CB for cardboard barrel, resulting in label number field being "TR-CB-1001" which would represent that it is a cardboard barrel. If they select box, then you have more options for the box category, i.e., LRGB for large box, or SM for small box, etc., resulting in the label number field displaying "TR-LRGB-1001" for large box. There would be three 4 fields, Category, Category Options, if any (since not all cagetories will have additional options, and price.
Oct 9 '14 #5
NeoPa
32,569 Recognized Expert Moderator MVP
Your original example didn't match your explanation. Your latest post confirms the original explanation as wrong but leaves only a couple of examples of some possible results. You need to redo your explanation properly so that it accurately reflects the question you mean to ask.

Please appreciate that, though the time of people here is offered for free, it is nevertheless of value to them and others they may otherwise be able to help.
Oct 10 '14 #6
pbsnow
14 New Member
Thank you for your response. My apologies for confusing anyone. In the next post I will try to give a better example of what I am trying to do.
Oct 10 '14 #7
pbsnow
14 New Member
Okay sorry for any confusion. I want to design a form which based on the selections, will generate a serial numbered label for that item. So, if someone selected from the category Barrels, and then chose 55 Gallon Barrel, the serial number would look like this "TR-55G-1001" TR will remain the same (represents company initials), 55G for 55 Gallon Barrel and 1001 from 4-digit autonumber field. I have attached a sample of the items table, for your reference. I need to also somehow have the form populate the fields based on their selections so it is a two part question, I guess.

So, main question is 1) how can I get a serial number field generated based on selection; and 2) {NeoPa - SNIP - Only one question allowed per thread - feel free to post another and link to this one.}

Attached Images
File Type: jpg items.jpg (46.1 KB, 1046 views)
Oct 10 '14 #8
NeoPa
32,569 Recognized Expert Moderator MVP
It's always difficult to explain technical requirements. Nevertheless very important to do so clearly and accurately, for the reasons explained in my last post. Let's see if we can help you clarify this as your JPEG gives us clues that are absent from your explanation.

The format of the serial number is :
  1. "TR-"
  2. Either a single character code "F", "M" or "V" as specified in your first post or a string of an indeterminate number of characters from the field [Code].
  3. Sometimes a hyphen ("-") but sometimes not (again depending on which posts you go by).
  4. Four digits of numbers to differentiate the item from any similarly specified items. Not important whether this is unique globally or just within similar serial numbers.

I was hoping to go forward from here but closer inspection of the information you've provided so far seems to indicate that the requirements have changed dramatically from first post to most recent one. This will need to be clarified in order to continue.

I appreciate you're probably trying to be clear, but would suggest a little more effort is required as, even after my earlier request, there is still much confusion caused by your explanations of the question.

NB. If the [Code] field is ultimately to be used in the determination of your serial number then it would be wise to ensure that what is used is of consistent length. Sections within an identifier, such as the serial number you propose, if of varying lengths, can cause many difficulties when trying to work with it in code. Generally not insuperable, but easily avoided with consistent lengths. That is to say that if one serial number is "TR-55G-1032" and another is "TR-MSCB-1043" then this will cause you problems. Well worth bearing in mind.
Oct 11 '14 #9
pbsnow
14 New Member
Thank you very much for your help. I will try what you have suggested and I will break it down to one character. I have tried many things and have not reached the desired result mainly because I am rusty with my programming since I haven't programmed anything in many years. I am better at manipulating things that have already be designed which are similar to what I want.

I would guess the first thing I have to figure out is how to populate the field with combo boxes and/or list boxes when I am inputting the desired information. Thank you very much for your time and your help on this.
Oct 11 '14 #10

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

Similar topics

0
2717
by: neoteny2 | last post by:
I need MS Access to automatically create reports/subreports based on specific criteria. I am building a database in Access 2003 with different locations/sites. I have the "sites" table created containing site info, including an empty field for "date". I also have a report format already created displaying the site info. I need Access to ask the user for a date, calculate three additional dates using the entered date (adding or subtracting...
1
1912
by: scanreg | last post by:
My form needs to (1) direct to specified URLs based on a combination of form selections and (2) enable/disable form features based on selections within the form FORM Radio 1 - A - B - C Select Box 1
2
4732
by: Quentin | last post by:
I would like to create a serial port listener that starts recording data to a text file as soon as the port starts receiving the data. How do I trigger the program to start running when data is sent to that port. Any help with the code would be great! Thank you!!
6
4315
by: Alvin SIU | last post by:
Hi all, I have a table in Db2 v8 like this: Team Name Role ------ -------- --------------------- A Superman Leader A Batman Member A WonderWoman Member B Alvin Leader
30
2611
by: vanlanjl | last post by:
Question: How do I create a Report based off the values/selections of mutliple combo boxes in a form? I have tried this several times with several failures and have used multiple codes to try this and each has been unsuccesful. I will try to explain my database and its contents Tabels and Fields ((PK) indicates the primary Key): tblAssets: ID(PK), AssetNumber, SerialNumber, ModelName, ComputerName, DeploymentDate, Active, UserName,...
15
4416
by: jt196 | last post by:
I'm trying to create an editable form of fulfilled orders on my system and am running into problems with creating a form based on this query. The field that I need to update (invoice number) is read-only. I DO understand the reasons for this: The query takes information from an orders table and a transactions table which have a one to many relationship. I don't want to use any of the transaction fields, but I do need to use a query based on...
12
8317
by: Ivan Popov | last post by:
I need to generate a unique serial number for each field in the table. The serial number shall consist of two letters and six numbers, for example AA123456. Someone can suggest how to do it in MS Access
13
8088
by: Scott Kaempfe | last post by:
I need to identify parts we buy at our plant. I want to give each a unique serial number that is based on the date. We may have multiple parts on a given date so I want to have the unique serial number in the format: MMDDYY-XXX where XXX is a unique number that start with 001 for the first item of the day. 002 for the second, etc. but starting over the next day. When a user enters info in the database, it may already have a number. If...
2
2155
by: jonathan184 | last post by:
Hi I am trying to get my query to work in my middleware which piggybacks off of the mssql driver using jdbc. Anyway, The query gets this error when i run in it the middleware ERROR: Failed to create input and/or output schema(s): "Duplicate field name found 'NAME', please modify the query and create unique aliases for duplicate fields"" The query otherwise runs fine in the microsoft SQL client in the studio This is the query I am trying...
10
8017
by: Wishbone1 | last post by:
Using Access 2007, I need to create an automatic Serial Number. I am new to Access and with no knowledege of writing codes. Example "7235-4300" "7" will be the current year "235" is day (Julian Date) "-43" is static "01" (SerialNo) is sequential, restarting at "01" each day I have searched the forum and found a detail explanation of the code and it works. However, the code did not provide how to get the 01 restarted each day.
0
8896
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
8810
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 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...
0
8659
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
7410
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
6211
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
5683
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();...
0
4208
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
2798
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
2
1790
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.