Solved: Access 2003 automatic field entry

Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

RANCHLAW56

Thread Starter
Joined
Dec 25, 2010
Messages
23
I have a field in my Access 2003 database that currently requires the user to enter the 2 digit month & 2 digit year of the incident as the prefix (prefix) to the case number. I would like to have this automatically created based on the date entered in the date of incident field (date).

Any ideas would be appreciated.
 

OBP

Joined
Mar 8, 2005
Messages
19,895
In the AfterUpdate event procedure of the date of incident field you need some VBA code. What exact format do you want the case number?
 

RANCHLAW56

Thread Starter
Joined
Dec 25, 2010
Messages
23
The full case number with the prefix would be 0312-0001. The prefix is stored in a seperate field in the table and used as reference for relation to the previous filing system and to prevent confusion with outside agencies. They do not have to be combined in the database.
 

OBP

Joined
Mar 8, 2005
Messages
19,895
me.Prefix = month(me.datefieldname) & Year(me.datefieldname)
the datefieldname should not really be date as that is the name for the System date and might cause some confusion for Access and VBA.
 

RANCHLAW56

Thread Starter
Joined
Dec 25, 2010
Messages
23
Almost there.... it is posting into the Prefix as 032010 (2 digit month and 4 digit year)
 

RANCHLAW56

Thread Starter
Joined
Dec 25, 2010
Messages
23
Private Sub Date_Received_Exit(Cancel As Integer)
Me.Prefix = Month(Me.Date_Received) & Format(Me.Date_Received, "yy")
End Sub


Returns error "Can't find project or library"
 
Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 807,865 other people just like you!

Top