I have a query with a custom function that works fine as long as I have not opened up the VBA editor. If that is/has been opened the query loops indefinitely calling the function with new data over and over looping through all the records and starting over again.
The function is a simple string manipulation. It turns ###-###-#### to ##########.
Anyone know of any bugs or something that causes this to happen?
Details:
Query
Function
The function is a simple string manipulation. It turns ###-###-#### to ##########.
Anyone know of any bugs or something that causes this to happen?
Details:
Query
Code:
DELETE tblTFN.TFN, *
FROM tblTFN
WHERE tblTFN.TFN Not In (SELECT fStripTFN(tblTempTFN.TFN) FROM tblTempTFN);
Function
Code:
Public Function fStripTFN(strTFN As String) As String
On Error GoTo Err_fStrip
If Len(strTFN) = 12 Then
fStripTFN = Left$(strTFN, 3) & Mid$(strTFN, 5, 3) & Right$(strTFN, 4) 'Formats ###-###-#### to ##########
Else
fStripTFN = Mid(strTFN, 2, 3) & Mid(strTFN, 7, 3) & Mid(strTFN, 11, 4) 'Formats (###) ###-#### to ##########
End If
Exit_fStrip:
Exit Function
Err_fStrip:
MsgBox Err.Description, vbCritical, Err.Number
Resume Exit_fStrip
End Function