Modules & VBA :: Autonumber Based On A Table Content With A Prefix

Oct 15, 2014

I have a module which generates an autonumber based on a table content (Tbl:Numbervalues) and a prefix (prefix held in Tbl: TextValues)

the module itself works fine and after every getprefix & getnextnumber it updates the number within numbervalues table to the next unique figure.

However what i want it to do is within my database i want to loop through all the records and update a column based on the getprefix() & getnextnumber()

so at the moment lets say column A has values of SHA000001 (in all 100 records) i want it to loop through those 100 records and update to be SHA(from the prefix table) and 000001 all the way to 000100.

Code:
Public Function GetPrefix() As String
On Error GoTo GetPrefix_ErrorHandler
GetPrefix = DLookup("Value", "TextValues", "Description = ""InvoicePrefix""")
If Len(GetPrefix) <> 2 Then
msgbox "The Invoice Prefix Value in the Text Values Table is not 2 characters long!", vbCritical, "Critical Warning"
End If

[Code] ....

View Replies


ADVERTISEMENT

Prefix Autonumber

Sep 27, 2007

Hi All,

I searched the forum before posting and couldn't find my problem, or how to adapt similar problems.

I have created a Database for call logging.

I have 2 types of call Change and Problem. I have 2 seperate tables for these. Each have an Auto Number as a primary key. One Prefixed with a 'C' and one with a 'P'. This was all fine, problem now being i have created a new table for Time Management.

I am trying to link the the time to a call, i can link the 2 primary keys to the 'reference' field in the time management, the problem being there are now 2, 000001, i can manually re-attach the P or C, but i want to write a report to see who's logging the most calls, to do this i wanted to use the time to look accross to Problem or Change and show the User ID, but when i query C000001, it show's no matchs as all thats stored in the table is 000001.

Any help or advice would be much appreciated.

Thanks,

Ian

View 3 Replies View Related

Prefix Autonumber

Jan 14, 2008

I found instructions that said in order to prefix an autonumber i.e. AAA000 you would have to write "AAA"000 in the format section under the general tab in the table design view of the field you are interested in.

I did this however even though the number now appears as AAA000, AAA001 etc in the table it does appear this way in the form - it just appears as 0,1 etc....

My actual prefix is 2006/1010/ i.e. 2006/1010/001, 2006/1010/002 and so forth.

Anyone have an idea of why not?

View 1 Replies View Related

Adding Prefix To Autonumber?

Jul 27, 2006

So I have a table with a bunch of data, InventoryID is the autonumber field which just increments normally, what I want to do is stick 'S000' in front of the autonumber, and for this to be the default prefix for any new items in my database - how would I go about this? I'm guessing some kind of append or update query would do it, but I'm no access whiz, help appreciated folks.........

View 2 Replies View Related

Autonumber With Customized Prefix

Dec 28, 2004

Ok...I've looked at old threads and now I'm more confused than before.
I'm trying to find a way to make my field "PCRTrackingNumber", work like this: 05-0001...05-0002...05-0003...and so on. The 05 represents the year. I currently have the field setup as autonumber, set to Long Integer and increment. Even if it looked like 05-1...05-2...05-3...etc. that would be fine. Basically just looking for a way to add "05-" to the prefix.
I was trying to think of a way to combine a field to the autonumber field and use that instead...but need some help.
Thanks, Jeff

View 2 Replies View Related

Create Field Content Based On The Content Of Others?

Apr 16, 2007

Can I create contents of one field based on the contents of others?

I have a database of pc systems which we've tested and was wanting to generate a single text line to identify the individual pc

The single filed would contain data from the following fields
Job Number
CPU Type
CPU Speed
RAM
HDD size

eg
So the new field would contain "Job345-P3-1000-256-20"

Can this be done?

View 3 Replies View Related

Tables :: Prefix And AutoNumber As Item Code

Jul 19, 2014

I'm making a new database and I want to assign Item Codes to my inventory. For example:

ItemCode (Primary Key) | Item | ItemDescription

I want to generate an automated item code containing the first letter of the Item (as prefix) followed by numbers. Example:

ItemCode: P001
Item: Paper
ItemDesciption: Ordinary white paper

View 14 Replies View Related

Forms :: How To Limit A Field Content Based On The Content Of Another Field

Nov 25, 2013

As I began thinking about the data that I need to include in one of my reports I relized that I need to gather some extra data.Each design change has a lifecycle with 7 basic states from not started through to closed. States 4, 5, and 6 have two posible sub-states that I need to capture and report. It is almost like having options.

My data entry form already records the 7 basic states. What I would like to do is have another field that records the sub-states if the design change is in one of those three states.

Will a ComboBox do this?

Do I need a test routine for the After Update event in the first text box? Something that will check for states 1 - 3 and 7 move on to the next field and if states 4 -6 require users to enter the sub-state.

Would a nested if-then-else routine do the job?

View 1 Replies View Related

Modules & VBA :: Matching Content To Other Content?

Feb 4, 2015

how many elements matching to my primary elements from any records of my query and count match, if some element doesn't match then I need to add it to my primary elements, then at the end (rst.eof) count how many primary elements I have.

E.G

id colours
1 blue;red
2 purple;blue;green
3 red;violet;purple;blue

dim matching_elements as long
dim primary_elements as string
dim TheNumberOfPrimaryElements as long

First of all, if I open recordset primary_elements is empty so I need to assign a value form first record.

primary_elements = rst!colours (so primary_elements = blue;red)

Now I can start comparing my primary_elements with second record:

matching_elements= 1
primary_elements = blue;red;purple;green

comparing my primary_elements with third record:

matching_elements= 3
primary_elements = blue;red;purple;green;violet

It's my last record so I need to count primary_elements

TheNumberOfPrimaryElements = 5

I need "matching_elements" to count other function in my application.

View 7 Replies View Related

Deleting Records Based On A Field Content?

Nov 16, 2004

Hi all!

I'm rapidly beginning to get a little confused... I'm trying to mass-delete records based on the content of a field.

I want to run either a query or a button on a form (or anything, for that matter) that will delete any records when there is an X in the N_Disp field.

Any ideas?

Thanks,

Barry

View 3 Replies View Related

General :: Dynamic Unbound Form Content Based On Database Entries

Jul 26, 2012

What I am wanting is to be able to build dynamic form content/elements based on entries on a table. This is for a gym membership system. What this form is going to be used for is to allow the front desk to scan a membership card which then performs a search on the database. Part of this search is going to be on a table that contains various add-on classes, tanning sessions, etc that a member can add beyond their base membership.

On the left side of the form, I will display a picture of the member and their name. What I am wanting to do on the right side of the form is to build a dynamic list of the add-on perks they are enrolled in.

I know I could hard program elements on the form to be visible or invisible, but that would be static and leave gaps when I have to turn things off b/c that member isn't enrolled in that class, etc.

Is this even possible with Access and VBA? I know I could do this sort of thing with a webpage using PHP, PERL or whatever. I don't know the limits of Access Forms and VBA.

View 5 Replies View Related

Tables :: Adding Same Prefix To All Columns In A Table

Jan 23, 2013

My database has three tables with many columns. The three tables are identical in the names of their columns.

I want to copy all columns from all three tables together into one single table, giving the respective columns prefix table1-, table2-, table3- since the columns would otherwise be indistinguishable.

I already tried to search the board for "table columns add prefix".

I use Access 2010

I managed to copy all columns together into one table through design-view, but cannot figure out the "add prefix" step.

View 9 Replies View Related

Adding A Prefix To Existing Description In Project Table

Apr 17, 2012

How to add a prefix to an existing description in a project table, generated from the project number. Here's a sample of my data:

PROJECT NUMBER DESCRIPTION
01200000 Completed Projects
01601530 Steele Sub

I would like the Descriptions to read:
01200000 MO-20 Completed Projects
01601530 MO-60 Steele Sub

The state, "MO," comes from the first two digits "01" and the coop, "60," comes from the second two digits. I have a table of a thousand or so projects in an Access database that I need to amend the descriptions of to include these prefixes. Is there a simple way to do this in Access or in Excel without writing code?

View 1 Replies View Related

Modules & VBA :: Reset Autonumber Each Time Delete / Append Records In A Table?

Oct 25, 2013

I need to reset the autonumber each time I delete/append records in a table. Best way?

View 5 Replies View Related

Modules & VBA :: Displaying Content / Value Of A Couple Of Variables

Sep 24, 2013

Debugging my VBA code. I'm trying to track/display the content/value of a couple of variables to make sure they have the right value at a certain point.

What is the VBA code to say "display content of variable Var1" ? Where exactly will it display the value when instruction is executed?

I know I can just hover the mouse on a variable to see its content but some string varables like SELECT commands are too long and you cannot see the whole string.

View 2 Replies View Related

Queries :: Take Content Of Two Fields From One Table And Dump Into Other Table

Jun 27, 2013

I am trying to take the content of two fields from one table and dump them into the other table, I created an Append Query pulling up just the main table and appending to the destination table but it doesn't copy the info when I run it. I also pulled in both the tables (and yes they are joined) doing the same as above and still it doesn't do anything when I run it.

View 1 Replies View Related

Tables :: Replacing 100% Of Table Content

Jul 1, 2014

I have a table (which has a few relationships) that contains 10.000 records up-to-date, but I've been making major changes to my database working on an old version from early June, when it had +9000 records.

What I'm planning to do to update the table:

export those 10.000 (up to date) records to a Excel file
delete those outdated +9000 records manually (select all + supr)
import the data from the Excel file so my new database is up-to-date again .

Is this acceptable or could lead to weird errors in the future?

View 2 Replies View Related

Forms :: Verifying Content Against A Table

Oct 8, 2014

I have a simple database that a user records the work they have done for the day. They are required to fill out the form with the item number, date, qty etc... the problem is some people are fat fingering things and i am not getting the right item numbers... I have a table called dbo_item with all the possible item numbers in it, is it possible that after they hit enter or click off the item number box it will tell them they put in an invalid item if it doesn't match one of the items from that table?

View 3 Replies View Related

Auto Refresh Table Content

Feb 27, 2012

I have a database in access that i have shared it and 5 person write in it. I want to show the datasheet in a monitor but my problem is hat I cant use auto refresh the Table datasheet. How can I auto refresh the datasheet of table when every client change it?

View 1 Replies View Related

Forms :: Coloring Form Field Based On Another Field Content

Jun 4, 2013

I am making a very simple 'registration' database for a children's event in a couple of weeks.I the table/form there is a checkbox field called 'consent' which, if checked, indicates that a child can leave the event without parental consent.

There is a report printed on each child (a registration page which the leaders get a copy of). I would like on this report a 'red box' to appear if the child cannot leave without permission (i.e. the consent box is not checked). I would also like this 'red box' to appear on the form. I had thought of doing it this way - but I'm not sure if it's the best, or if it's possible:

Have a field in my table called 'consentindicator'. When the 'consent' box is checked, there is a period ('.') placed into the 'consentindicator' field. It is set to turn red when a period is present. That way, when the consent box is checked, a get a red 'box'.

View 12 Replies View Related

Modules & VBA :: Control Height Of Multiple SubReports With Varying Content On Report

Jul 8, 2013

I am working on a report that will have 16 sub-reports, one right below the other. Because of the complex nature of the calculations in the groupings it seemed easier to "build" the report using vba rather than using the report's built-in grouping ability. The issue I am running into is that there seems to be no simple way to control the height of the sub-reports. I had hoped that setting "can grow" to yes would change the height of the sub reports and move all subsequent sub reports down (Allas)

As an alternative I thought too that I might be able to set the height of the sub-report control, which would make for a tricky but not impossible bit of programming, but (Again allas) I can't seem to find a reasonable way to determine the required height of the sub-report's control.

View 3 Replies View Related

Modules & VBA :: Add Rows To Table Based On Record Count Of Another Table

Mar 10, 2015

I am trying to assign teams to players. I have an import table with all of the players information listed. What I want to do is determine the count of players in a given city. For every 9 players I want to add a new record to the Team table and assign the team number (auto incremented for each team created). Then I want to add the players to the Players table with the Team Number that was created.

View 8 Replies View Related

Modules & VBA :: Update Column In Table Based On Another Table

Apr 24, 2015

I'm trying to use VBA to update a new column in a table with info I already have in another table.The table I want to update is an inventory details table, it has around 25,000 records. I added a column called "UnitCost", of course the column is empty for all 25,000 records so I would like to fill it easily using DoCmd.RunSQL "UPDATE" feature.

I use that through-out the program however I'm unable to connect the dots for this one.What it needs to do is update "UnitCost" in "InventoryDetails" from "Products" where "InventoryDetails.ProductNumber" = "Products.ProductNumber"

The "Products" table has all the different unit cost, it just need to be placed in the "InventoryDetails" table for every record. Of course product1 needs products1 unit cost and product2 needs products2 unit cost, etc.

View 1 Replies View Related

Modules & VBA :: Replace Values In One Table Based On 2nd Table

Jan 12, 2015

I have a table (tblConversions) that I'm using as a base for replacing values in a different table. tblConversions is set up as such and is made up of nearly 100 records:

ID LABEL CODE
1 Ashaway ASH
2 Barrington BAR
3 Bristol BRI
4 Jesse Smith BUR
....

Another table (tblSysItemLoc) has nearly 1,000 records with a field for Location Names such as Ashaway New Books, Ashaway Fiction, Ashaway Non-Fiction, Barrington DVDs, Barrington Reference, etc. Other fields in this table are just statistics.

What I need to do is loop through tblConversions, and find in tblSysItemLoc where the Location field Starts With the value from tblConversion.LABEL and replace the Entire field with the CODE. For example, from tblSysItemLoc "Ashaway New Books" gets changed to "ASH", "Barrington Reference" gets changed to "BAR", etc.

I feel like I need a loop inside of a loop, but I'm not sure where to begin. Loops are not my specialty.

View 10 Replies View Related

Custom Autonumber Based On Lookup

Jul 8, 2013

Custom Autonumber based on lookup. I am creating an access database where autonumbers to be work.

I have a table with Segment Name my main table will lookup the values of segment table.

Based on the Segment I choose Autonumber has to be created

My main table to house each record (tbl_import) has the following fields:

ID
Segment
Port
MOT
TOTAL CIF

Child table - Segment contains
Development
Deployment

Testing

So based on segment field which I choose

Development autonumber has to set DEV-1001 and Deployment has to set DEP-2001, TEST-3001

My thought is if there a way to code the Segment field to lookup the segment what I choose based on the Autonumber series starts (similar to a vlookup in excel), then concatenate the DEV in the Record ID field.

View 2 Replies View Related

Tables :: AutoNumber Based On Location Strings

May 1, 2013

I have two tables that are related: BUCKETS & LOCATION

BUCKETS has these fields:ID (autonum)
Type (type of bucket)
Creation Date (when it was created)
Operational (if it is operational or not (Yes/No).
Location (Location of the bucket)
Notes (notes)

LOCATIONS has these fields:LocationAutoID (Autonumber)
LocationCity
LocationID
BucketsOnSite (can have multiple entries)

What I'd like to have done is for LOCATIONS table to be aware of how many different cities there are. So for instance, if there is multiple location entries for the cities of Vancouver and Toronto in there, I want the LocationID to first know how many Torontos there are and in LocationID to combine the LocationCity and a count (starting from 1) to that field.

So for example, if there are three toronto locations and two vancouver locations, LocationID would have TO-01, TO-02, T0-03 for the Toronto locations and VAN-01, VAN-02 for Vancouver locations.

At first I had the expression of [LocationCity] & "-" & [LocationAutoID] in the Expression field in the Field Properties but I quickly realized that it wouldn't count the amount of cities but just add the autonumber and the city (which kind of works, but not ideally).

View 8 Replies View Related







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