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

Group serial number

5 2Bits
"I'm not programmer but I'm interested to work on Ms Access"

I have table on that table there are many cities I want each city to have unique serial

E.g.

New York city, serial start N125 then serial like this N125-0001 next N125-0002 and forward

Then Another city

Florida start F352-0001 then F352-0002

To explain I have field include cities and field for each city have unique code e.g. (New York code is N125, Florida is F352)

I have form I want when I choose city from combo box it run automatically serial of this city on another text box

So now my form I have 3 fields
City (combo box)
Code (auto get when choose city)
Serial (which I need to auto get)

Kindly help me with detail expression and where to put exactly

I found some solution from previous answers but maybe I don't do it right so please explain me the expression and where to put it

Thanks
Mar 5 '23 #1
3 19247
NeoPa
32,556 Expert Mod 16PB
It's hard to know what you want. You seem to be asking for the whole thing to be done for you - which is not appropriate in case you aren't aware.

In principle you need to design a database that has a table for your States where each record has at least the code for the State as well as its name.

You would also require a separate table that holds Cities. This would also need, at least, speces for the name and the code.

From there it's not clear what you intend. Do you expect to add all the cities in some batch process somehow? Do you plan to make a sysytem that allows operator(s) to add cities to the table based on a Form?

Alternatively, what are you asking for? A clearer explanation would be helpful, but remember that the request must fit within the rules, so one simply for work to be done all for you is not acceptable.
Mar 6 '23 #2
Bright1Light
5 2Bits
Simply
Now let me give example
I have 2 tables
One table have 2 fields for
[ID] [City] [code] (number in code not related to anything
1 New York N256
2 Florida F352
Another table
[ID] [Supplier] [Amount] [City] [code] [group serial]
1 blabla 4321 New York N256 N256-001
2 blabla 5678 Florida F352 F352-001
3 blabla 5467 New York N256 N256-002

I have form for this table include
[City] (combo box called "CCity")
[code] (text box "TCode"get auto value after update "CCity")

What I want is to have
Text box for [group serial] called "TGS"
that also auto give serial based on "TCode" value which based on "CCity"
On that
If I enter New York I get N256-001
If enter Florida get F352-001
another New York get N256-002
So on

Thanks for help
Mar 6 '23 #3
cetpainfotech
15 Byte
Here's an expression you can use in the "Serial" textbox control's Control Source property to generate the unique serial number:

=DLookUp("Max(Serial)","YourTableName","City='" & [City] & "'") & "-" & Format(DCount("*","YourTableName","City='" & [City] & "'")+1,"0000")

Replace "YourTableName" with the name of the table that contains the data for your form, and replace "City" with the name of the field that contains the city name in your table.

This expression first looks up the maximum serial number for the selected city from the table using the DLookup function. It then concatenates the city code with a hyphen separator, and appends a counter value that is obtained by counting the number of existing records for the selected city in the table using the DCount function.

The Format function is used to pad the counter value with leading zeros to ensure that it is always four digits long.

To use this expression, simply set the Control Source property of your "Serial" textbox control to the above expression, and set the Row Source property of your "City" combo box control to a query or table that contains the list of cities and their corresponding codes.

Note that this expression assumes that the first serial number for each city should be in the format "N125-0001" or "F352-0001". If you want to start the counter at a different value, you can adjust the second argument of the Format function accordingly.
Mar 23 '23 #4

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

Similar topics

3
by: Niy | last post by:
what does that mean? what for? I searched a lot but failed to find explanation. Sometimes I really have difficulty finding documentation for some views.
15
by: tom | last post by:
Hi, How do I get the serial number of the harddisk in .NET? I want this to be the same number even if the user has reformatted, so I do not want the volume serial number. Thanx, t
5
by: | last post by:
Hi, Do memory sticks have serial numbers like harddrives? If so how can I get this, I want to uniquely identify a memory stick (removable drive) for authentication. Thanks
79
by: Klaus Bonadt | last post by:
In order to protect software from being copied without licence, I would like to use something like a key, which fits only to the current system. The serial number of the CPU or the current...
3
by: Mark Harris | last post by:
I have an installer which uses a Customer Information page in it, is there an easy way to pass the serial number entered to a custom action? If not, where would i find the serial number in the...
3
by: Jefe | last post by:
Hi group I'm trying to implement a console application which work just lie "Dir" instruction in MS-Dos prompt window so I need to display Volume Serial Number and also the free space, how can I...
14
by: Lauren Wilson | last post by:
Discovered this interesting comment on MSDN: "To programmatically obtain the hard disk's serial number that the manufacturer assigns, use the Windows Management Instrumentation (WMI)...
9
by: Nebojsa4 | last post by:
Hi. First, sorry on my weak English to all. Qusetion: How to read (in VB) Manufacturer serial number of Hard disk drive? Not volume/serial number of C:, D:, etc. partitons. For reading...
1
by: Keshia | last post by:
I have a database that is for keeping track of inventory. I need to have my form for entering new inventory to automatically make a new serial number based on the category of the new item. The...
7
by: mike1hello | last post by:
I have a warehouse database. I have created a query which searches the table for duplicate serial numbers and give me a warning message, that works. My Code Private Sub...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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...
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
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,...
0
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...
0
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...
0
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...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.