Ms Access.... Custom Autonumber Format

This is a discussion on "Ms Access.... Custom Autonumber Format" within the Databases section. This forum, and the thread "Ms Access.... Custom Autonumber Format are both part of the Program Your Website category.


 Subscribe in a reader

Go Back   Webforumz.com > Main Forums > Program Your Website > Databases

Notices




Closed Thread
 
LinkBack Thread Tools
  #1  
Old Feb 1st, 2004, 15:38
New Member
Join Date: Feb 2004
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Ms Access.... Custom Autonumber Format

Hi all.......I'M Using Ms Access to develope a db...which I want to set an autonumber format like this "FAMAOR-YY-XXXXX"....The YY = Year and the xxxxx = autonumber...and the example of generate autonumber should be like this "FAMAOR0200001".....can anybody
tell me how to do this
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!

  #2  
Old Feb 1st, 2004, 16:58
Most Reputable Member
Join Date: Jul 2003
Posts: 1,856
Thanks: 0
Thanked 0 Times in 0 Posts
We'll I'd say you'd want to use the regular autonumber for one of the fields in the table. Then after you've added the record, grab the autonumber generated and format it into your index string with the year and leading zeros, which you would then update your record with using the autonumber as the identifying key.

Basically 2 steps needed, at least for Access anyway.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
  #3  
Old Feb 2nd, 2004, 04:17
New Member
Join Date: Feb 2004
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Hello Catalyst......Thanx for reply but can tell a little bit more on how to do this coz I'm kindda new in this whole db thing and I aslo don't have a clue how to do the string at all......may god bless you for your help
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
  #4  
Old Feb 2nd, 2004, 07:31
Most Reputable Member
Join Date: Jul 2003
Posts: 1,856
Thanks: 0
Thanked 0 Times in 0 Posts
What language are you using with Access?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
  #5  
Old Feb 2nd, 2004, 08:23
Rob's Avatar
Rob Rob is offline
Webforumz Founder
Join Date: Jul 2003
Location: Southern UK
Age: 34
Posts: 3,184
Blog Entries: 7
Thanks: 27
Thanked 22 Times in 19 Posts
I can only presume VBA
__________________
Click the 'Thanks!' button if this post has helped you

Rob - Webforumz Founder
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
  #6  
Old Feb 2nd, 2004, 08:56
New Member
Join Date: Feb 2004
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
I'm using Vba.....but the problem is also not very good in programming
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
  #7  
Old Feb 2nd, 2004, 17:12
Most Reputable Member
Join Date: Jul 2003
Posts: 1,856
Thanks: 0
Thanked 0 Times in 0 Posts
Here's sample code for doing this in vba:
http://www.experts-exchange.com/Data...2.html#7747320

You might need to signup for a free membership to view the code.
If you have questions about the sample code just ask.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
  #8  
Old Apr 16th, 2004, 01:51
New Member
Join Date: Apr 2004
Location: Indonesia
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Hi guys, still need help here

so for example I have a wheel table...
wheelID(pk), wheelName, wheelSize, etc.

the other table is the autoIncrement which consist of two fields: perfix (pk, text) and increment(autonumber)

the format for wheelID is W"wheelsize"-"0001" and so on
for example W17-00001, W17-00002, W18-00010, W19-00001

the problem here, I dont get what the codes are doing :mad:

---- code start --------
Dim wheelID As String
Dim db As Database "when I run the program, theres an error here - user defined type not defined"
Dim autoNumber As Recordses

wheelID = "V" & *i dont know how to get wheelSize* & "-" (will this go to table Whell.wheelID?)

Set db = CurrentDb()
Set autoNumber = db.OpenRecordset("increment")

autoNumber.MoveFirst

autoNumber.Edit
autoNumber!increment = autoIncrement!increment + 1
autoNumber.Update

wheelID = wheelID & Format(autoNumber!increment, "00000") *is this the way to get the increment value from table autoIncrement?*

autoNumber.Close

----- code end ----------

this coding doesnt seem to work.
in vba coding part, where do I put this coding? on form load event ? or on form current event?

Thanks in advance guys
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
  #9  
Old Apr 17th, 2004, 01:45
New Member
Join Date: Apr 2004
Location: Indonesia
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
i've got it working now
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
  #10  
Old Apr 19th, 2004, 17:19
Most Reputable Member
Join Date: Jul 2003
Posts: 1,856
Thanks: 0
Thanked 0 Times in 0 Posts
Good job
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Closed Thread

Tags
format, autonumber, custom, access

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
ASP Multi users Access to Microsoft Access ish Classic ASP 0 Apr 26th, 2007 20:05
Access Autonumber Start Value redkyna Databases 2 Aug 25th, 2004 06:08
Access Autonumber redkyna Databases 2 Aug 24th, 2004 09:37
Update autonumber field in Access Database redkyna Databases 3 Aug 20th, 2004 09:18
Format Auto Number in MS Access 2000 dretzka Databases 2 Aug 10th, 2004 13:37


All times are GMT. The time now is 04:43.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42