Using wildcard in update query

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Seems like something simple, but I can't figure out how to do this update
query (for just one column in the table.)

I need to replace first 6 numbers with an asterisk and keep the rest of the
numbers, i.e. replace 123456789123456789 with ******789123456789
There are over 200,000 records in the table.

Thanks for the help!
 
are all the numbers the same length???

if so, set the update to

"******"&right([Field],12)

BTW: You probably want to update that to a different Field so that you do
not lose the original numbers.
 
First back up your data, you wont be able to roll back

Try
"******" & Mid([FieldName],7)

You can create a select query to return this field
Select TableName.*, "******" & Mid([FieldName],7) As NewFieldName From
TableName

In update query
UPDATE TableName SET TableName.FieldName = "******" & Mid([FieldName],7)
 
You're bound to have problems, because the "*" character has special meaning
to Access.

Try the following:Chr(42) & Chr(42) & Chr(42) & Chr(42) & Chr(42) & Chr(42) &
Right(VarName,Len(VarName)-6)

HTH
First back up your data, you wont be able to roll back

Try
"******" & Mid([FieldName],7)

You can create a select query to return this field
Select TableName.*, "******" & Mid([FieldName],7) As NewFieldName From
TableName

In update query
UPDATE TableName SET TableName.FieldName = "******" & Mid([FieldName],7)
Seems like something simple, but I can't figure out how to do this update
query (for just one column in the table.)
[quoted text clipped - 4 lines]
Thanks for the help!
 
I think ofer is correct, actually.

The "*" is only treated as a wild card with special meaning when you use
with Like operator or some functions that accept wild cards.

On the RHS of an "assignment", "*" is certainly a normal character "*".
 
Back
Top