Hi Everyone,
I know this topic has been posted a lot, so I apologize for having to post another one, but the answers I've been finding seem to be more advanced than I know how to use.
I have a table called [MOC Tracking Log], with a field named [MOC ID Number]. The general format for this number is supposed to be (yyyy-0001). The last 4 digits are supposed to increment each time a new record is created (ie, 2007-0002, 2007-0003 etc). I have found some useful code (i think) to do the incrementation part itself. However:
1) I don't know how to set the original format to be (yyyy-0001)
2) I don't know where to put the code.
So far, I have this:
which is basically a random jumble of code snippets I've found and can only somewhat make sense of.
Any clarification, or links to understandable tutorial sites would be greatly appreciated.
Thanks,
Tiffany
I know this topic has been posted a lot, so I apologize for having to post another one, but the answers I've been finding seem to be more advanced than I know how to use.
I have a table called [MOC Tracking Log], with a field named [MOC ID Number]. The general format for this number is supposed to be (yyyy-0001). The last 4 digits are supposed to increment each time a new record is created (ie, 2007-0002, 2007-0003 etc). I have found some useful code (i think) to do the incrementation part itself. However:
1) I don't know how to set the original format to be (yyyy-0001)
2) I don't know where to put the code.
So far, I have this:
Code:
Private Sub Form_Load() Format (Date = "yyyy") Dim tdf As TableDef Dim fld As Field Dim num As Double num = "0001" Set tdf = CurrentDb.TableDefs("[MOC Tracking Log]") Set fld = tdf.Fields("[MOC ID Number]") fld.Value = (Date & "-" & num) fld = ("SELECT Max(Right([MOC ID Number])) As MaxNum FROM [MOC Tracking Log]") num = fld!MaxNum + 1 End Sub
Any clarification, or links to understandable tutorial sites would be greatly appreciated.
Thanks,
Tiffany
Comment