Hello all,
I just joined and was hoping someone here could help me out. I'm trying to modify a field in a table by calling a function. It runs without error, however the value I'm trying to modify is replaced with a null value rather than the value the function provided. Here is my code:
Public Sub Clean()
Dim Sql
Sql = "Update [tablename] SET [Item] = CleanFunction([Item]) WHERE [shipped by] like 'ACME'"
DoCmd.RunSQL Sql
End Sub
Public Function CleanFunction(Item)
If Item Like "??JD*" Then
Item = Mid(Item, 6, 99)
Else: End If
End Function
What could it be? Thanks in advance.
I just joined and was hoping someone here could help me out. I'm trying to modify a field in a table by calling a function. It runs without error, however the value I'm trying to modify is replaced with a null value rather than the value the function provided. Here is my code:
Public Sub Clean()
Dim Sql
Sql = "Update [tablename] SET [Item] = CleanFunction([Item]) WHERE [shipped by] like 'ACME'"
DoCmd.RunSQL Sql
End Sub
Public Function CleanFunction(Item)
If Item Like "??JD*" Then
Item = Mid(Item, 6, 99)
Else: End If
End Function
What could it be? Thanks in advance.