Skip to main content

Dialog Box to rename a field

Hi everyone,
I hope you are doing great. I would like to ask for a help.
I need a script to update a historical information and for that I renamed a column using a dialog box, but it is not working.

Brian Element Sat, 04/02/2022 - 07:31

I think you are missing some quotes:

field.Name = """" & Dat & """"

There should be four quotes on each side.  The two in the middle give you the single quote in the string.  The two outer quotes are opening and closing the string.  Right now the equation editor is seeing:

"DAT" and it doesn't know what to do with it.  With the change it will instead see what is included in the Dat variable.

ElaP Mon, 04/04/2022 - 06:57

Hi Brian
Thanks for your reply, but now I have a new error 
(task.ReplaceField "SCORE", field) "The default field name is invalid. Field names may only contain letters, numbers and underscores and must begin with a letter."
I didn`t understand this error.  Both variables name, the initial and the new one, has only letters and numbers, and begins with letter.
Thanks a lot
 

Brian Element Mon, 04/04/2022 - 07:49

Sorry, my fault.  I was thinking that the field.Name was an equation when it wasn't.  So I was giving you advice if this had been an equation.

What you need to do is just make it equal to the variable so:

field.Name = Dat

And that should do it.

The website encountered an unexpected error. Try again later.