Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Simon Arnold
  Where is Simon Arnold?
 Halifax
 United Kingdom
 Simon Arnold
 To: Paul Michael
  Where is Paul Michael?
 Shelton
 Connecticut - United States
 Paul Michael
 Tags
Subject: RE: Syntax problem???
Thread ID: 21735 Message ID: 21736 # Views: 24 # Ratings: 0
Version: Visual FoxPro 5 Category: General VFP Topics
Date: Monday, March 31, 2003 10:11:38 PM         
   


> Hello All:
>
> I have a table I created (ref. POM3Z.DBF) that has 576 records. When I ship a package using the post office service I want to check the Zipcode the user enters, and the ARRAY for this field is 'sa_cust[8]'. I want to take this zip verify it against my table and verify what SACK# (ref. SCFCODE field) the package/envelope goes in.
>
> For example: I ship a package to 01023, the Sack # would be 010 (ref. SCFCODE field). Last the Sack number would be displayed on the processing screen (ref. the field/ARRAY that would diplay data is the 'sa_cust[1] '). Keep in mind that this function is being intergrated to an existing software program written in (VFP 5.0); customizations such as fuctions are allowed through a prg file (cust_main.prg) and can be called several ways.
>
> Thank you,
>
> ERROR MSG:
> "Invaid subscript reference"
>
> and..
>
> "SQL: Statment is invalid"
>
> POM3Z.DBF Defs:
> zip |zipend code |zone |scfcode |bmcnum |adccode
>
> Code:
>
> function GetSackNo
> lparameters a_cust[8] && zipcode field/array on the shipping screen that user inputs.
> select scfcode from POMB3Z.dbf ;
> where a_cust[8] between zip and zipend ;
> into array sa_cust[1] && numeric text field on the shipping screen to diplay sack#.
> if (_Tally > 0) && always return 1 for valid zipcodes
> return (.T.)
> endif
>
> endfunc

You cannot define a parameter as an array, you need to change the function like so:
FUNCTION GetSackNo
LPARAMETERS tcCust
	LOCAL llRetVal
	SELECT scfCode FROM POMB3Z ;
		WHERE BETWEEN(tcCust,Zip,ZipEnd) ;
		INTO ARRAY sa_cust
	IF _TALLY > 0
		llRetVal = .T.
	ELSE
		llRetVal = .F.
	ENDIF
RETURN llRetVal


Hope This Helps.
Simon Arnold.


COMPLETE THREAD

Syntax problem??? Posted by Paul Michael @ 3/31/2003 9:30:42 PM
RE: Syntax problem??? Posted by Simon Arnold @ 3/31/2003 10:11:38 PM
RE: Syntax problem??? Posted by Paul Michael @ 3/31/2003 10:34:02 PM
RE: Syntax problem??? Posted by Michael Gill @ 4/1/2003 12:46:11 AM
RE: Syntax problem??? Posted by Simon Arnold @ 4/1/2003 1:08:51 PM
RE: Syntax problem??? Posted by Paul Michael @ 4/1/2003 6:41:59 PM
RE: Syntax problem??? Posted by Paul Michael @ 4/1/2003 7:29:43 PM
RE: Syntax problem??? Posted by Michael Gill @ 4/1/2003 7:52:16 PM
RE: Syntax problem??? Posted by Paul Michael @ 4/1/2003 8:01:50 PM
RE: Syntax problem??? Posted by Paul Michael @ 4/1/2003 8:04:35 PM
RE: Syntax problem??? (UPDATE on problem) Posted by Paul Michael @ 4/2/2003 2:34:47 AM
RE: Syntax problem??? (UPDATE on problem) Posted by Jamie Osborn @ 4/2/2003 4:19:34 AM
RE: Syntax problem??? (UPDATE on problem) Posted by Paul Michael @ 4/2/2003 6:12:26 PM