Modules & VBA :: Create Unique Reference Number Based On Field Values For Record

Jun 18, 2015

I want Access to automatically generate a reference number for a record based on the values in on two other fields for a given record using a form.

The first field is called Operation Number.

The second is Bag Number.

The reference number needs to be in this format: 19C.3.1

Where 19C is the Operation Number, 3 is the bag number, and 1 is automatically generated. Additionally I need the last number --the automatically generated one--to go back to 1 if with each new bag number.

This is kind of like library catalog numbers. Not sure how to do this.

View Replies


ADVERTISEMENT

Forms :: Generate A Unique Reference Number Record Wise

Jun 10, 2015

Need to generate a unique reference number each record wise while data entering by a form. How to do this by using a command button ? After entering all fields related to the record, when click on the command button, unique reference number for that record need to be generated and save with all other data of the records. in a later event, need to recall the record by using this reference number and also need to make relation ship with some other table by using the reference number.

View 6 Replies View Related

Modules & VBA :: Get Number Of Unique Values Without Separating Values That Belong To Same Block?

Dec 5, 2014

I have the following dataset in a table called NR_PVO_120. How do i pick out a number (which can change but let's say, 6) of UNIQUE OtherIDs without excluding any OtherIDs under any fax numbers?

So, if you pick OtherID from Row7 you then also must pick OtherIDs from rows 8 and 9 because they have the same fax number. Basically, once you pick an OtherID you're then obligated to pick all OtherIDs that have the same fax number as the one you picked.

If the number requested (6 for this example) isn't possible then "the closest number possible but not exceeding" would be the rule.

For example, if you take OtherIDs from rows 1-10 you will get 6 unique OtherIDs but row 10 shares a fax with rows 11 and 12. You either need to take all 3 (but that will raise the unique count to 8, which isn't acceptable) or skip this OtherID and find one with a fax that has no other OtherIDs and that isn't on the result set already. My result of 6 UNIQUE OtherIDs will need to contain ALL OtherIDs under any fax the existing OtherIDs are connected to.

So one solution is to take rows 1-6, 26. Another is to take rows 1-4,10-14.

There will be many possibilities (the real dataset has tens of thousands of rows and the number of people requested will be around 10K), as long all OtherIDs connected to all faxes on the result set are part of the requested number (6 in this case) any combination would do.

A few notes.

1.Getting as close as possible to the requested number is a requirement.

2.Some OtherIDs will have a blank fax, they should only be included as a last resort (not enough OtherIDs for the requested number).

my table (NR_PVO_120)
Row OtherID Fax
1 11098554 2063504752
2 56200936 2080906666
3 11098554 7182160901
4 25138850 7182160901
5 56148974 7182232046
6 56530104 7182234134

[code]....

A few sample outputs

one solution is taking rows 1-6 and 26.

OtherID
11098554
56200936
25138850
56148974
56530104
56148975

Another solution is taking rows 1-4 and 10-14.

OtherID
11098554
56200936
25138850
56024315
56115247
56148974

This is for a fax campaign, we need to make sure no fax number is faxed twice, that all people connected to that fax number are contacted under one fax sent.

View 12 Replies View Related

Queries :: Loop To Create New Tables With Unique Field Values

Sep 20, 2013

I have a table - (Table A) that has 2 fields X and Y. I would like to write a query or script to make two new tables based on the unique values found in field X. In other words, all data where field X = 1 would be written to a new table called "1" and all data wehre field X =2 would be written to a new table called "2".I would like this done automatically.

Table A
Field X Field Y
1 a
1 b
1 c
1 d
2 a
2 b
2 c

View 5 Replies View Related

Modules & VBA :: Count Number Of Unique Records Based On Range Of Date

Jan 19, 2015

Code:
' count records in query
Dim rs As DAO.Recordset
Dim db As Database
Dim strSQL As String
Dim beginDatum As String
Dim eindDatum As String
Set db = CurrentDb

[code]....

View 4 Replies View Related

General :: Creating Unique Ordered Number Field With Auto Shifting Values

May 31, 2013

I'm creating a database using existing data from an excel file full of contact details. What I need to add is a queue type system where each contact in the database has a "Place in Queue" number which is unique obviously.

Lets say Alan is number 1, Bob is 2 and Chris is 3. They have these corresponding numbers in the queue field for their entries.

Now what I need to have, through use of a form, is a way of changing Chris from number 3 in the queue to number 1 and thus have Alan automatically shift down to number 2 and Bob to 3.

View 4 Replies View Related

Unique Reference Based On PK And User Selection

Nov 10, 2005

Hello,

I am trying to create a unique reference number that includes the default autonumber and another count based on what the user selects from a dropdown (B).

For example, the reference might look something like these examples:

AutoDropdwnADropdwnBCount
001DrinkMocha1
002DrinkEGrey1
003DrinkEspresso1
004DrinkLatte1

005DrinkEGrey2
006DrinkEGrey3
007DrinkEGrey4

008DrinkEspresso2
009DrinkLatte2
010DrinkEspresso3

I will eventually create a unique reference by combining all the data (ie: 004-Drink-Latte-1, 010-Drink-Espresso-3) but it will allow me to number each type of drink in ascending order irrespective of the autonumber (which is the primary key.)

I would appreciate any advice on how to approach this! I am baffled!

Thanks,

dj_T







:eek:

View 2 Replies View Related

Queries :: Adding Sequential Numbers To Generate A Unique Reference Number

Oct 5, 2013

Basically what I have is a database for tracking/logging parcels that arrive to the office. I want to be able to generate a reference number based on the date of arrival: i.e. the reference number should be ddmmyy### where ### is a sequential number. I know that I could just use the primary key's autonumber, for the sequential number but if I do this then the sequence will not restart at 1 on each date and because we receive a lot of parcels the reference number will grow to be too big to print out on the collection slips in just a few months.

two tables (one with the date and staff on duty that day and the other with the parcel's info') with a one to many relationship

I also have a query (Named: FullLog) that picks up the following data from the tables:

Name - Description - Size - TrackingInfo' - Staff - DateReceived - Count

The field named Count is a DCount function that I used to find out the number of times each date is repeated. This is the Expression that I used:

Count: DCount("*","FullLog","DateReceived = " & [DateReceived]) [Note that DateReceived is first converted into a string using CStr()]

This is as far as I have been able to get, I have been looking for weeks for a solution to this problem but I have yet to find one. I don't even know if the DCount function is the correct way of doing it, I did read somewhere that this produces a very slow query.

Effectively what I want to be able to get is something of that resembles the following

DateReceived - ReferenceNo

051013 051013001
051013 051013002
051013 051013003
061013 061013001
061013 061013002
071013 071013001
071013 071013002
071013 071013003
071013 071013004
071013 071013005
081013 081013001
081013 081013002
091013 091013001
101013 101013001

View 6 Replies View Related

General :: Creating Unique Sequential / Reference Number Every Time Report Is Printed

Feb 15, 2013

I have a rental database and I print several contacts for leases etc. what I want to do is have a unique reference number or something inserted to the report every time that it's printed. What I am trying to achieve is to keep track of which tenant corresponds to the report (Lease) printed by using reference number.

There is a seperate form which holds the tenants details and I would like to have a field on that form which would show the same reference number as the report so I can track which report was printed for who.

Whats the best/easiest way to accomplish this?

View 1 Replies View Related

Unique Number Will Not Create

Jan 17, 2007

Hello i want to create a tracking number based on information entered into a form.

So i have my main table called "MainData" and this is in the backend and linked through to the front end where my form is.

I then have a query which is called "calllog" which has a field called "Call Number" inwhich i placed the following

=Year([Date]) & Left([CustomerName],3) & Right([Date Created],2)

This then gives me a unique number. Once i have entered a job in it will generate a number. Now this part works fine but it does not update the Maindata. How can i get the this to transfer the data to the maindata table???

View 6 Replies View Related

Forms :: Create Automatic Unique Number?

Apr 12, 2013

I am trying to create an automatic unique 'number' (actually text) in a form. Here is an example of the format...

1456.R1
1456 is the project number
R stands for revision
1 is the first revision

So, in this database there could be 1456.R2 etc. but there could also be other project numbers, say 2323.R1, 2323. Looking for expression I need to enter to have Access look up the last revision for a specific project and then add 1 to it?

View 10 Replies View Related

How To Create All Unique Values In 4 X 4 Matrix Table

Oct 6, 2012

if I got a 4 x 4 matrix table - 4 rows and 4 columns - MS Access 2007/2010 the values should exist as below with no repetition of any number in any of the cells.

1 2 3 4
5 6 7 8
9 10 11 12
13 14 15 16

a number should not repeat in any of the cells.I set a primary key on cloumn 1 and defined unique on all the fileds but that doesn't work since 1 columns does not know what the other cell contains and no relationship exists.

View 6 Replies View Related

Create A New Record, Opening A Form Based On The Key Field

Jan 28, 2005

I seem to need some help!
I have a table with customer information in it ie: name, vehicle, (Key=Id number)...
it is the master link to the repair table ie: mileage, (Key=ROnumber), and repair data..
these two work together beautifull
now I need to add another table, a check sheet for checking over a vehicle.
I create the table and the form however I cannot open a new form with the ROnumber from the second already open form into the newly open form.
(the second form is based on a Query, and I have tried changing it to a SQL statement both with no luck)
is there an example of what I need to be doing to link the ROnumber to the ROnumber in the new form, or create the ROnumber so it will add the data in the linked table?
I need this to open using a button on the open repair form
David

View 1 Replies View Related

Modules & VBA :: Create X Number Of Duplicate Records According To A Field On Subform

Jun 13, 2013

I have a code that works great from the parent form but I decided to change the format and call it from a lostfocus event in the subform instead. Now I keep getting error 3314:"You must enter a value in the tbGuests.LastName field".

The code should copy the parent form fields and create x number of duplicate records according to a field on sub-form. It then runs an append query to add the information from the subform.

Code:

Private Sub GuestsInParty_LostFocus()
Dim partymsg As Integer
Dim dbs As dao.Database, rst As dao.Recordset
Dim F As Form
Dim intHowMany As Integer
Dim intCounter As Integer

[code]....

View 1 Replies View Related

Modules & VBA :: Formula Based On Record Number - Recordset Required?

Dec 14, 2014

In order to arrive at the required solution I have to perform a calculation, using data from each successive table record (in chronological order). The result of each calculation must then be used to arrive at the result for the next calculation.

In other words I have to update a variable based on data from each record, sorted in chronological order, and use the final result to populate a field on a form.

Is it time to break out my copy of "VBA For Dummies" and start learning how to use Recordsets?

View 8 Replies View Related

Modules & VBA :: New Record Button With Prefilled Number Based On Selection On Another Table

Jan 6, 2015

I'm making a database that so I can log calibration information about equipment every year.I have 2 tables:

The Equipment details table
The Calibration record table

ID Number is shared between the 2 tables so a calibration record can be linked to its' details.

For Example (simplified sample data):

Equipment Table
ID Item Unit Type
104 Thermometer DegC PT100

Calibration Table
ID Cal Point 1 Test Equipment Unit Under Test Date
104 20 21 22 06/01/15

What I want is a button on a form that creates a new blank record in my Calibration record table with the ID number already entered based on what record I selected in a combo box linked to my equipment table. I really don't know where to start.

View 2 Replies View Related

Modules & VBA :: Pick Field Based On Number Of Clicks

Apr 23, 2015

I'm incrementing a counter every time I click on a combobox by using the on click event and this code:

Code:
POcount = POcount + 1

I have 5 fields on my form: GWS1, GWS2, GWS3, GWS4 and GWS5.I want to store the value of the combobox when clicked into the correct GWS field. For example: If I click the combobox 3 times it would store the value of the combobox after the 1st click in GWS1, after the 2nd click in GWS2 after the 3rd click in GWS3.I tried

Code:
me."GWS & POcount" = combobox1

but that's invalid syntax.

View 4 Replies View Related

Queries :: Adding Sequence Number To Transactions Based On Date And Unique ID

Jul 29, 2014

I have a set of transactions with a Unique ID field and a date. I want to add a field based that gives me the sequence of events for each Unique ID in order of when it happened.

For example, if customer X has 6 transactions, the sequence field would have a number (1-6) in each record that corresponds to the order in which those transactions occurred. The first transaction would have the number 1, the second would have the number 2 and so on.

View 3 Replies View Related

Reference A Fields Values In The Record Source Query

Dec 30, 2007

I have a query on a form that is providing all of the information I need for everything on my form.

The problem is I don't know how to refer to a field's value in the query in VBA without having a hidden text field on the form.

I know I can reference a combo box's query to include criteria such as [Forms]![cboSelectStudent] if the control is actually on the form, but how would I refer to a value in the form's query that doesn't have a control on the form.

I've been searching for everything I can think to call this but haven't been able to come up with anything.

Thanks.

View 6 Replies View Related

Modules & VBA :: Populate A Field With A Sequence Number Based On Two Criteria?

Sep 11, 2014

I am trying to get the max of an integer field if the ProjectNumber field is equal to the ProjectNumber field in the current record. I have used code similar to the one below before but it was on a date field, then add one.

Me.RevisionNumber = Nz(DMax("[RevisionNumber]", "dbo_ProposalLog", "[ProjectNumber] =" & Me.ProjectNumber), 0) + 1

The ProjectNumber field is a text field.

View 6 Replies View Related

Modules & VBA :: Adding Various Values Based On Select Case To Value Of Field

Oct 1, 2014

I am trying to add various values based on Select Case to the value of field. The problem I face is that each time when I get different Case in select statement, the value of the field rather changing adds the value on top.

Code:
Private Sub ProductID_AfterUpdate()
Dim qflPrice As Variant
Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim sqlQry As String
Dim instID As Integer

[Code] .....

View 5 Replies View Related

Tables :: How To Create A (unique) Field

Nov 12, 2012

I have a table as followed;

EmployeeID: PK
FirstName
MInitial
LastName
Company:FK
Department:FK

What I want to do is create a new field that automatically populates based on what is entered into the above fields.

Essentially creating a single field with unique data generated by multiple fields.

For Example if I entered the following informaiton:
EmployeeID: 1 (AutoNumber)
FirstName: John
MInitial: P
LastName: Doe
Company: FederalGov
Department:Test

The new field can be generated as followed: JohnPDoeFederalgovTest

What i plan on doing with this is making this "generated" field an index so no new duplicated records can be added.

View 5 Replies View Related

Modules & VBA :: Automate Generation Of Reference Number Incrementally By 1

Jul 29, 2013

I am trying to automate the generation of a reference number incrementally by 1.

In my main table (tblBooking) I have my primary key field autBookingID which is an autonumber.

In another table (tblBookingStops) I have the primary key as autBookingStopsID as the autonumber and then numBookingID linked to the above table (tblBooking). I have another field called txtGPSID so this is the number I would like to automate.

So for example:

tblBooking:
autBookingID: 1234
tblBookingStops:

[Code]....

I want to put the code that would populate the txtGPSID on a form in datasheet view and would like to put the code on the load event.

View 5 Replies View Related

Unique Number To Identify Each New Record Created

Sep 23, 2011

Example 1:

2011-1
.......
2011-3893 etc.

Currently I have an Access form which produces a new unique number to identify each new record created. To do this I use the unique ID autonumber from a table to identify the new records. I would like to change from this simple number to the the above format per example 1. The four digits to the left of the hyphen would always be the current year and digits to the right of the hyphen would be the unique auto incrementing numbers such as from my table. I need the year to auto increment by 1 each September 30th (new business year) and I need the numbers to the right to auto reset to 1 to start uniquely identifying records again for the new incremented year. As each record is closed I need the number to be written as a single entity in the new format to my database.

Example 2: After September 30th.

2012-1
.......
2012-447 etc.

View 3 Replies View Related

Count Taking Reference Of Two Field Values

Jun 15, 2006

Can anyone help?

I have few of these columns in my query


Loc Company Pack RoundedNum SumTotal
2 ASDA AA 1
2 ASDA AA 5 6
1 Asda AC 2 2
1 ABC BB 10
1 ABC BB 1 11
2 XYZ AR 1 1



I am trying to achieve "SumTotal" column result. In the above query RoundedNum is an expression achieved from other columns(not shown above) from the same querytable. Now I want to insert this "SumTotal" column which will count for Total RoundedNum as per same type of Packs.

Thus the Total Field should look like the one shown above. Any idea how can i achieve this? :confused:

Thank you in advance.

View 2 Replies View Related

Queries :: How To Remove Duplicates On Reference Number Field

Aug 28, 2013

I have a query which gets information from 2x tables where the I'd on one table is the reference number on the second table.I would like to know how I can remove the duplicates on my reference number field?

View 3 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved