Check out
www.candice-tripp.com for autonumber code. You can use that and
then append your "JNL" to the front. I have done similar but I first run a
query to strip off the number portion of the field and then to determine the
Max value. My code looks similar to this on the button to create a new
record. I have added comments to help you understand:
DoCmd.GoToRecord , , acNewRec
DoCmd.SetWarnings False
[ReferenceNumber]=0
/ where reference number is a hidden field on the form
DoCmd.OpenQuery "qryLastReferenceNumber"
/ a make table query as described above
Me.[ReferenceNumber].DefaultValue = DLast("LastRef","tblLastRef")
/ where LastRef in tblLastRef is the result of the make table query
Me.[Reference]="JNL" & Right (([ReferenceNumber]+1000000),6)
Me.Refresh
DoCmd.SetWarnings True
Hope this helps.
kmhnhsuk said:
But it is not the query that I am using. I want to store the reference in
the table.
--
Kevin
KARL DEWEY said:
Just add the prefix in your queries like --
Reference: "JNL"& [YourAutonumberField]
kmhnhsuk said:
Hi,
I am trying to create a table that has a Reference field set to include the
letters 'JNL' as a prefix and then an autonumber. This field will be used
just as a reference and not as a counter or anything so I am not worried
about losing numbers in the sequence.
How can I achieve this?