I have an application where we scan and save package tracking barcodes. DHL, UPS and USPS all scan fine. But the FedEx barcode enters too many characters. If a tracking number is 793656940953, then the scanned barcode results in 37704674520000017936569409532015. So I need to add an event for checking if an entry into the "TrackingNo" field has 32 characters. It it does, then the first 16 and last 4 characters need to be removed. An additional factor is that I already have the even below for ensuring no duplicate entries occur. So I am having a tough time combining a function for the new need and keeping this. Any help in adding the new feature to the code below would be appreciated.
' Before record added
Function BeforeAdd(ByRef values,ByRef message,inline)
Dim dict
Set dict = values
'** Check if specific record exists ****
dim rsExists
set dal_table=dal.Table("MailQuery1")
set rsExists = dal_table.Query("TrackingNo='" & values("TrackingNo") & "'","")
if not rsExists.eof then
BeforeAdd=false
message = "This tracking number has already been entered."
else
BeforeAdd = true
end if
rsExists.Close : set rsExists = Nothing
End Function ' BeforeAdd
arrEventTables("BeforeAdd")="MailQuery1se"
arrAvailableEvents("BeforeAdd")=true