Results 1 to 7 of 7
  1. #1
    RANCHLAW56 is offline Novice
    Windows XP Access 2003
    Join Date
    Dec 2010
    Posts
    13

    Access 2003 automatic field entry

    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.

  2. #2
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Have you looked at the DatePart() function yet?

  3. #3
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Actually the Format() function would serve as well here.

  4. #4
    RANCHLAW56 is offline Novice
    Windows XP Access 2003
    Join Date
    Dec 2010
    Posts
    13
    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"

  5. #5
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Try:
    Code:
    Private Sub Date_Received_AfterUpdate()
       Me.Prefix = Format(Me.Date_Received, "mmyy")
    End Sub

  6. #6
    RANCHLAW56 is offline Novice
    Windows XP Access 2003
    Join Date
    Dec 2010
    Posts
    13
    That fixed it. Thanks.

  7. #7
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Any time. Glad we could help.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 9
    Last Post: 12-15-2010, 01:44 PM
  2. Replies: 2
    Last Post: 05-05-2010, 02:52 PM
  3. Automatic field check and population
    By danidin in forum Forms
    Replies: 0
    Last Post: 01-03-2009, 12:45 PM
  4. Automatic Data Entry on a Specific Date
    By alanbrai in forum Programming
    Replies: 2
    Last Post: 11-14-2007, 05:15 PM
  5. Replies: 1
    Last Post: 09-06-2006, 11:48 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums