Re: VFP 9, Macro substitution and Error 1231

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



<start of code snippet>
LOCAL lcWhere, lcCreate

lcWhere = " &lcCriteria "

&& String used to create the view by macro substitution
lcCreate = " CREATE VIEW ByLocation AS SELECT * FROM Location WHERE " ;
+ "DELETED() = .F. AND (" + lcWhere + ")"

&& Create the view - this works fine in version 8 but generates a
&&Missing Operand error in version 9

&lcCreate
<end of code snippet>

VFP is correct in raising a 'missing operand' error as lcCriteria is
undefined at this point.
--
Robert Hoogstraat


"jndb72" <jndb72@xxxxxxxxxxxxx> wrote in message
news:1118930122.975188.94060@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
> Hi All,
>
> We recently upgraded from version 8 to version 9 and have come across
> an issue with macro substitution. A lot of our views are created to
> allow for diffrent requerying scenarios, based on diffrent fields
> within the view. Below is an example that works fine in v8 but crashes
> with a Missing Operand error in v9.
>
> CREATE DATABASE Test
> CREATE TABLE Location (cCountry C(12), cGroup C(3))
>
> INSERT INTO Location VALUES ("GB ", "A01")
> INSERT INTO Location VALUES ("USA", "A01")
> INSERT INTO Location VALUES ("FRA", "A02")
> INSERT INTO Location VALUES ("AUS", "A02")
> INSERT INTO Location VALUES ("ITA", "A02")
>
> LOCAL lcWhere, lcCreate
>
> lcWhere = " &lcCriteria "
>
> && String used to create the view by macro substitution
> lcCreate = " CREATE VIEW ByLocation AS SELECT * FROM Location WHERE ;
> DELETED() = .F. AND (" + lcWhere + ")"
>
> && Create the view - this works fine in version 8 but generates a
> &&Missing Operand error in version 9
>
> &lcCreate
>
> && This all works fine in v8
>
> USE ByLocation NODATA
>
> && Requery the view
> lcCriteria = " cCountry = 'GB ' "
> REQUERY("ByLocation") &&Returns 1 record in v8
>
>
> lcCriteria = " cGroup = 'A02' "
> REQUERY("ByLocation") &&Returns 3 record in v8
>
>
> I've read through the "whats new in 9" section but haven't yet come
> across anything that would explainn this issue.
>
> Anyone have any thoughts?
>
> jndb72
>


.



Relevant Pages

  • VFP 9, Macro substitution and Error 1231
    ... allow for diffrent requerying scenarios, ... with a Missing Operand error in v9. ... LOCAL lcWhere, lcCreate ... && String used to create the view by macro substitution ...
    (microsoft.public.fox.programmer.exchange)
  • Re: VFP 9, Macro substitution and Error 1231
    ... Leonid ... > allow for diffrent requerying scenarios, ... > with a Missing Operand error in v9. ... > && String used to create the view by macro substitution ...
    (microsoft.public.fox.programmer.exchange)
  • Re: VFP 9, Macro substitution and Error 1231
    ... macro substitution would fail during ... compilation at any time. ... > VFP is correct in raising a 'missing operand' error as lcCriteria is ... >> with a Missing Operand error in v9. ...
    (microsoft.public.fox.programmer.exchange)