> 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.