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

Auto assign number with in every place that i choose from combox

15
Can anyone help me/..i have a problem in auto numbering. this is the case
i have a combo box named municipality then with values like
Dapa, Gen. Luna and Pilar.
with another combo box named barangay with values
if i choose Dapa the Values in combo box barangay will be Brgy. 1, Brgy. 2 and Brgy. 3.
and if i choose Gen. Luna the Values in combo box barangay will be Consuelo, Cloud9 and Tawin2x
so on and so fort.....
when i choose municipality of dapa and barangay Brgy. 1 i want to auto assign number starting from 100 with a code per barangay(ex: Municipality of Dapa, Brgy. 1 .. code = va-100)


any help out there?
Nov 30 '13 #1
3 1017
zmbd
5,501 Expert Mod 4TB
natyboi:

Your actual post is extremely hard to follow; however, it sounds like you need a compound lot/serial/sequence number. For simplicities sake, all of these are interchangeable terms.

The topic of compound lot/serial/sequence numbers comes up here quite frequently; thus, a simple search on the site will turn up a ton of solutions.

By way of a general solution, given that your post is quite garbled:

You will need VBA or Macro code (these are DIFFERENT programming methods, you will receive more help via VBA than in Macro) running behind the scenes... usually a command button on click event, or perhaps an on_current event that checks for the new record etc...

then:

What I consider the simplest in a properly normalized database is that in the table where this will be stored, there would be one field for the first part of the serial number (say "va" using your example) and a second field that holds the sequence number.

To determine the next sequence, you run a query grouping on the code field ([Municode]) with filter such that the field returns only the code of interest (for example: [Municode]="va") and the max of the sequence number field. In VBA, you then simply increment the number by one or what ever you need to increment by get the next number.

To get your actual "serial number" would be to use a calculated field or control, so that, say in a query, the field named [Serial_Number] would be:
serial_number: [Municode] & "-" & [SequenceNumber]

I typically prefer to have the calculation at the query level instead of the report or form level when possible; however, especially in a form, there are times that this must be done at the form or report levels such as if these are batch numbers generated at report run time (such as a page number would be) that are not necessarily unique in nature..

As I mention before, there over 30 different examples here on this site within the last 6 months with code and/or SQL provided by ADezii, Neopa, Rabbit, and myself.

IF you don't find something that fits, please post back with a clearer explanation and perhaps an example or two.

At This Time, PEASE DO NOT ATTACH: Pictures, textfiles, or any other file. A clear explanation is all that is needed. If you wish to have a formatted table of text, please click on the [CODE/] button and place the text between the inserted tags as they will preserve your formatting.
Most of the experts on this site will not, or in my case, can not open un-solicited attachments or can not see/access them when you use a third party site.
Nov 30 '13 #2
natyboi
15
much appreciated sir..thank you very much. i will construct a much understandable explanation .
Dec 1 '13 #3
natyboi
15
Ok sir..lets make it a simple one.
like this.
example i have a combobox with a values like Japan, Philippines, China and i also have a textbox named txtautonumber

if i choose japan, txtautonumber will give a sequential number.same as i choose philippines or china

ty sir
Dec 1 '13 #4

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

Similar topics

0
by: amywolfie | last post by:
Hi all: I have a subform called sfrmFootnotes linked to main Form frmFeeInput (the latter based on tblFees). tlkpFootnotes contains the PK for Footnotes. tjnCode_Footnotes is a join table...
8
by: Robert Misiak | last post by:
Is it possible to manually change the auto-build number used in VS.NET? Thanks, Robert
5
by: Phil Latio | last post by:
I have 2 virtually identical tables and wish to move data between them. Basically one table is called "live_table" and the other is named "suspended_table" and the only difference is that the...
3
by: jdvon | last post by:
Reports and Queries return auto ID number instead record itself Access 2002 when I run a report or a query they result in the auto ID number (in some cases) rather than the value iteslf. What...
2
by: G | last post by:
Hello Firends I want a sample code for developing an " auto genearte number " and want to store in database. Please if you find any code please send Thanks in Advance G
1
by: prasannashet | last post by:
hi i am using access 2000 and vb 6 as front end i have used auto increament number field in one of the my talble during some error the transaction will rollback but auto number in a table will...
9
zimes
by: zimes | last post by:
I am working with Microsoft Access 2003 from the Office XP pro suite. I have created several tables that have to do with Asset tracking along with purchasing. I have a table called Purchasing,...
2
by: infosyed | last post by:
Hai I am doing project in C#.Net. i want to know how to create the Auto Generation Number in Text Box. I want store that number in Sql Database also. Anyone can help me. Advance Thanks for Your...
1
by: Karan Singh Goyal | last post by:
I have an access table which have fields like Customer Id, First Name, Last Name etc. i know how to generate auto number but when i delete last record it generates next number instead of previous one...
2
by: Jagdish Patil | last post by:
I have project in asp.net with sql server backend. i want to auto generate a number for particular column. with the auto generated number i want to insert some other data in the same row same...
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: 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
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: 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
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...

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.