Scenario
I have two tables. Table 1 is for a job and table 2 is for tasks completed on that job. I am looking at not using the auto number and currently has work a system were a ID is genereated based on date i.e 20170921 - 1 were the "-1" increments for every job and these number resets everyday . I currently have this working but resets every year. Also In Table two I want this linked to Table 1 but have an ID that increments 1,2,3,4 based on job so that it resets when a second job is entered.
I am looking to change the code below so that it does no reset the sequential number every year but resets everyday. I have been trying to look at the bottom codes but cannot get the numbering to reset daily or if the date does not appear in a table. Could i please request so help on modifying the following code. I am a relative beginner to access database and VBA so I may be looking at the wrong implementation. also would be greateful at any help for sequential numbering bases on a sub form.
Table 1
ID
Request ID
Date of Request
Item Subject to change
Change category
item reference
justification for change
approval for change
rtest
yearid
monthid
dayID
BaseID
BCustID
FormatID
First Code
'If IsNull(Me![BaseID]) Then
'Me![BaseID] = Nz(DMax("[BaseID]", "[tblChangeManagement]", "[YearID]='" & Year(Date) & "'"), 0) + 1
'End If
'Me![CustID] = [FormatID] & [YearID] & [MonthID] & [DayID] & "-" & Format([BaseID], "00000")
'End If
Second Code
If DLookup("DateOfRequest", "tblChangeManagement", Date) Then
Me.[BaseID] = Format(Nz(DMax("[BaseID]", "[tblChangeManagement]", "[YearID]='" & Year(Date) & "'"), 0) + 1)
Else
Me.[BaseID] = 1
End If
Me![CustID] = [FormatID] & [YearID] & [MonthID] & [DayID] & "-" & Format([BaseID], "00000")
End Sub