Duplicate ticket numbers

dowingc

Board Regular
Joined
Oct 27, 2002
Messages
77
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
 

Excel Facts

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number

Forum statistics

Threads
1,221,825
Messages
6,162,166
Members
451,750
Latest member
dofrancis

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top