Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can someone please tell me why this replace won't work

Status
Not open for further replies.

Kerbouchard

IS-IT--Management
Aug 28, 2002
145
US
It's VFP 5.0
Code:
set talk on
use s:\d\ar\arcUST03 shared again in 0 alias cust order custno
replace all;
cust.salsmn1 with "JEA001", cust.salsmn2 with "LAN004", cust.comrate with 15,;
cust.compct1 with 67, cust.compct2 with 33, cust.terr with "32",;
for zip between VAL("19701") and VAL("19708"),;
and INLIST(type,"REST",'CLUB','CRUI/AIR','DI','INST','OTH COMM','PURCHASE','RE/HO/CA','RENTAL','REP'

It keeps giving me invalid syntax on
for zip between VAL("19701") and VAL("19708"),;

As always many thanks in advance!
 
why not directly say
Code:
for between(zip,19701,19708)
it will run a bit faster.

also, your code has some typo.
Code:
replace all;
cust.salsmn1 with "JEA001", cust.salsmn2 with "LAN004", cust.comrate with 15,;
cust.compct1 with 67, cust.compct2 with 33, cust.terr with "32"[b][COLOR=red],[/color][/b];
for zip between VAL("19701") and VAL("19708")[b][COLOR=red],[/color][/b];
and INLIST(type,"REST",'CLUB','CRUI/AIR','DI','INST',;
'OTH COMM','PURCHASE','RE/HO/CA','RENTAL','REP'
should read
Code:
replace all;
cust.salsmn1 with "JEA001", cust.salsmn2 with "LAN004", cust.comrate with 15,;
cust.compct1 with 67, cust.compct2 with 33, cust.terr with "32";  [COLOR=green]&& REMOVED THE LAST COMMA[/color]
for between(zip, 19701, 19708);  [COLOR=green]&& SYNTAX REVISED, REMOVED LAST COMMA[/COLOR]
and INLIST(type,'REST','CLUB','CRUI/AIR','DI','INST',;
'OTH COMM','PURCHASE','RE/HO/CA','RENTAL','REP'[b][COLOR=blue])[/color][/b]  [COLOR=green]&& ADDED CLOSE PARENTHESIS[/color]

hope this helps. peace! [peace]

kilroy [trooper]
philippines

"Illegitimis non carborundum!"
 
This is still being stubborn. I can't believe something that looks so simple can be so complicated. If it helps the zip part giving the trouble is a zip code stored as a character in the table.

Code:
set talk on
use s:\d\ar\arcUST03 shared again in 0 alias cust order custno
replace all;
cust.salsmn1 with "JEA001", cust.salsmn2 with "LAN004", cust.comrate with 15,;
cust.compct1 with 67, cust.compct2 with 33, cust.terr with "32",;
FOR BETWEEN(zip,19701,19708);  [COLOR=red]Error still here[/color]
and INLIST(type,"REST",'CLUB','CRUI/AIR','DI','INST','OTH COMM','PURCHASE','RE/HO/CA','RENTAL','REP')
 
Kerbouchard,
The error would appear to be the comma (,) after ... cust.terr with "32". Is ZIP a numeric field?

Rick
 
... a zip code stored as a character in the table.
Then it should be

FOR BETWEEN(zip, "19701", "19708")

And remove the comma after cust.terr with "32" , too.

 
It was the comma, holy cow, that was frustrating! Thanks everyone!!!!!!!!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top