sdpsc
Technical User
- Feb 10, 2001
- 76
I'm trying to create a program that will help us with formatting phone lists. It searches to see if the lname1 field exists, and if not, finds fields that may be the last name field and renames them. I'll run this when there is no lname1 field but there is one of the others, it always gives me a "Variable LN is not found" error. However, the column will still get renamed to lname1. Any help would be greatly appreciated! Thanks!
set stat on
x = 0
numFields=aFields(aColumns)
For i=1 To numFields
If Upper(aColumns(i,1))='LNAME1'
x = 1
EndIf
Next
if x = 0
For i=1 To numFields
If Upper(aColumns(i,1))='LASTNAME'
alter table testdb rename column lastname to LNAME1
EndIf
If Upper(aColumns(i,1))='LN'
alter table testdb rename column ln to LNAME1
EndIf
If Upper(aColumns(i,1))='LAST_NAME'
alter table testdb rename column last_name to LNAME1
EndIf
Next
endif
set stat on
x = 0
numFields=aFields(aColumns)
For i=1 To numFields
If Upper(aColumns(i,1))='LNAME1'
x = 1
EndIf
Next
if x = 0
For i=1 To numFields
If Upper(aColumns(i,1))='LASTNAME'
alter table testdb rename column lastname to LNAME1
EndIf
If Upper(aColumns(i,1))='LN'
alter table testdb rename column ln to LNAME1
EndIf
If Upper(aColumns(i,1))='LAST_NAME'
alter table testdb rename column last_name to LNAME1
EndIf
Next
endif