P
p-rat
I have this code that I'm trying to fix. The data type on a field
(Field_Ticket_Number) was changed from integer on the back end to
nvarchar. I'm a beginner and am trying to figure out how to make this
code work now with a string instead of number:
Private Sub dbo_Field_Ticket_Header_Field_Ticket_Number_BeforeUpdate
(Cancel As Integer)
Dim lngField_Ticket_Number As Long, strCriteria As String
If IsNumeric(Me.dbo_Field_Ticket_Header_Field_Ticket_Number) Then
lngField_Ticket_Number =
Me.dbo_Field_Ticket_Header_Field_Ticket_Number
strCriteria = "[Field_Ticket_Number] = " &
lngField_Ticket_Number
If SearchTableByCriteria("dbo_Field_Ticket_Header",
strCriteria) Then
MsgBox "That ticket number already exists in the database.
Please enter another ticket number.", vbExclamation
Cancel = True
End If
Else
MsgBox "INVALID TICKET NUMBER.", vbExclamation
Cancel = True
End If
End Sub
(Field_Ticket_Number) was changed from integer on the back end to
nvarchar. I'm a beginner and am trying to figure out how to make this
code work now with a string instead of number:
Private Sub dbo_Field_Ticket_Header_Field_Ticket_Number_BeforeUpdate
(Cancel As Integer)
Dim lngField_Ticket_Number As Long, strCriteria As String
If IsNumeric(Me.dbo_Field_Ticket_Header_Field_Ticket_Number) Then
lngField_Ticket_Number =
Me.dbo_Field_Ticket_Header_Field_Ticket_Number
strCriteria = "[Field_Ticket_Number] = " &
lngField_Ticket_Number
If SearchTableByCriteria("dbo_Field_Ticket_Header",
strCriteria) Then
MsgBox "That ticket number already exists in the database.
Please enter another ticket number.", vbExclamation
Cancel = True
End If
Else
MsgBox "INVALID TICKET NUMBER.", vbExclamation
Cancel = True
End If
End Sub