Hi All,
I am writing an update query to update a text field.
The field looks like 000XXXXXXXXX.
Not all fields have a 000 in the front. I want to delete only the 000 and leave the rest of the data.
Here is what I have.
Dim SQL1 As String
SQL1 = "UPDATE [customers] SET [acct] = Replace (acct, '000', '') " _
& "WHERE SUBSTR(acct, 1, 3) = '000' "
DoCmd.RunSQL SQL1
This compiles but then I get an error message
Undefined Function 'SUBSTR' in expression. I have tried both SUBSTR and SUBSTRING. What am I doing wrong. Some research said you can't use substr with a text field that it can only be used with VarChar is this correct? if So how do I convert this to VarChar?
I am writing an update query to update a text field.
The field looks like 000XXXXXXXXX.
Not all fields have a 000 in the front. I want to delete only the 000 and leave the rest of the data.
Here is what I have.
Dim SQL1 As String
SQL1 = "UPDATE [customers] SET [acct] = Replace (acct, '000', '') " _
& "WHERE SUBSTR(acct, 1, 3) = '000' "
DoCmd.RunSQL SQL1
This compiles but then I get an error message
Undefined Function 'SUBSTR' in expression. I have tried both SUBSTR and SUBSTRING. What am I doing wrong. Some research said you can't use substr with a text field that it can only be used with VarChar is this correct? if So how do I convert this to VarChar?