I 'inherited' a computer help desk trouble ticket program. I am fairly well versed in VBA for Excel, but Access is a whole different animal for me. The problem is, rarely when we open a new ticket, we will get a duplicate trouble ticket number.
The backend of the database is sql. I checked the tables and found that the TT# field is not required to be unique. I looked around and can't figure out how to change it, not sure if I want to, don't know what it would break. Is there a way to add some VBA to check the last ticket number and increment by one? Here is the bit of code that determines the ticket number now:
Function TroubleTicketsLoad()
On Error GoTo Err_TroubleTicketsLoad
Set FRM - Form_frmTroubleTickets
With FRM
If IsNull(FRM.TT) Then
FRM.TT = CreateAutonumber(Format(DATE, "yy") & "-" & Format(DatePart("y", DATE), "000") & "-", 3)
End If
Exit Function
Err_TroubleTicketsLoad:
FRM.TT = CreateAutonumber(Format(DATE, "yy") & "-" & Format(DatePart("y", DATE), "000") & "-", 3)
End With
End Function
All help is appreciated!
Chris
The backend of the database is sql. I checked the tables and found that the TT# field is not required to be unique. I looked around and can't figure out how to change it, not sure if I want to, don't know what it would break. Is there a way to add some VBA to check the last ticket number and increment by one? Here is the bit of code that determines the ticket number now:
Function TroubleTicketsLoad()
On Error GoTo Err_TroubleTicketsLoad
Set FRM - Form_frmTroubleTickets
With FRM
If IsNull(FRM.TT) Then
FRM.TT = CreateAutonumber(Format(DATE, "yy") & "-" & Format(DatePart("y", DATE), "000") & "-", 3)
End If
Exit Function
Err_TroubleTicketsLoad:
FRM.TT = CreateAutonumber(Format(DATE, "yy") & "-" & Format(DatePart("y", DATE), "000") & "-", 3)
End With
End Function
All help is appreciated!
Chris