Hi
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
Could someone help me out? I'm not sure what I'm doing wrong here...I've tried combinations of quotes, etc with no success.
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
Could someone help me out? I'm not sure what I'm doing wrong here...I've tried combinations of quotes, etc with no success.