Can't update using docmd.runsql

Joined
Apr 7, 2011
Messages
1
Reaction score
0
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top