Results 1 to 3 of 3
  1. #1
    3 Star Lounger
    Join Date
    Nov 2004
    Location
    Nottingham, Nottinghamshire, United Kingdom
    Posts
    326
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Adding a new reference number to a form (Access 2003)

    Hello all!

    I have a database containing several records, all with a reference number. What I need to do is when a new record is created, create a new reference number based on the last reference number.

    For example, the last reference number would be ST06043, the new record reference number would be ST06044. Is there any way to do this automatically when the 'add record' button is clicked? I'm afraid I have no knowledge/experience of Access VBA whatsoever so any and all assistance would be gratefully accepted.

    Thanks!
    <font color=448800><font face="Comic Sans MS"><big>Lyra J </font color=448800></font face=comic></big>
    <img src=/S/flags/UK.gif border=0 alt=UK width=30 height=18> Ducking the arrows in Robin Hood country <IMG SRC=http://www.wopr.com/w3tuserpics/Lyra_J_sig.gif ALT="No, Admins, no! I'm sorry, okay!" title="No, Admins, no! I'm sorry, okay!">

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Adding a new reference number to a form (Access 2003)

    If all reference numbers are to begin with "ST", I would use a number field, and prefix it with "ST" whenever needed in a form or report. You can then use one of the methods described in <post:=287,907>post 287,907</post:> (with, of course, the appropriate names substituted).

  3. #3
    3 Star Lounger
    Join Date
    Nov 2004
    Location
    Nottingham, Nottinghamshire, United Kingdom
    Posts
    326
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Adding a new reference number to a form (Access 2003)

    <img src=/S/hello.gif border=0 alt=hello width=25 height=29> Hans

    Thanks, I'll give it a try (though to be honest don't hold out much hope as my 'expertise' in this area is near-as-dammit zero!). If it works I'll send you a giftwrapped [choccybar]...

    <img src=/S/thankyou.gif border=0 alt=thankyou width=40 height=15>
    <font color=448800><font face="Comic Sans MS"><big>Lyra J </font color=448800></font face=comic></big>
    <img src=/S/flags/UK.gif border=0 alt=UK width=30 height=18> Ducking the arrows in Robin Hood country <IMG SRC=http://www.wopr.com/w3tuserpics/Lyra_J_sig.gif ALT="No, Admins, no! I'm sorry, okay!" title="No, Admins, no! I'm sorry, okay!">

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •