I'm creating a variable as new com object(the com is in vb).
it opens successfully.
I have a let and get for Field:
$objView = new COM("my.comobj")
the Get: $objView->Field("fName")
works and I get the parameter, but this :
$objView->Field('fName") = "newValue";
gives a Parse error: parse error, unexpected '=' in ...
if I try to use the let function in vb (same function name,takes 2 params)
I get an error in number of arguments sent.
does anyone knows how to do this set??
Guy
Com question
Moderator: General Moderators
- twigletmac
- Her Royal Site Adminness
- Posts: 5371
- Joined: Tue Apr 23, 2002 2:21 am
- Location: Essex, UK
You appear to have a mismatch of quotes (single and double) in this line here:
try changing it to:
Mac
Code: Select all
$objView->Field('fName") = "newValue";Code: Select all
$objView->Field('fName') = "newValue";it's not quotes problem
the get works, with either 'fieldname' or "fieldname".
the problem is when adding the = 'newvalue'
i get an a parse error on the = .
this syntax works in vbscript. ( the source im converting to php now)
thanks
Guy
the problem is when adding the = 'newvalue'
i get an a parse error on the = .
this syntax works in vbscript. ( the source im converting to php now)
thanks
Guy
- twigletmac
- Her Royal Site Adminness
- Posts: 5371
- Joined: Tue Apr 23, 2002 2:21 am
- Location: Essex, UK
- twigletmac
- Her Royal Site Adminness
- Posts: 5371
- Joined: Tue Apr 23, 2002 2:21 am
- Location: Essex, UK
Further to my question above about Field() being a function. This test:
produced the same error message that you are seeing. You can't set a function to be equal to something, you could however pass variables to it as arguments so it can adjust a variable based on these. I don't know what arguments Field() might take but have you tried:
Mac
Code: Select all
function Field($val1, $val2)
{
$val1 = $val2;
return $val2;
} // end func
Field('fName') = "newValue";Code: Select all
$objView->Field('fName', 'newValue');sorry, the ' " is a typo, and Field is a Function
in the com interface (a get for the field) I also have let but I get a number of arguments error when trying to invoke it.
btw - since it's a function I tried to pass the return value by reference to a another function (php one) and then set it, but it didn't work.
maybe I did it wrong
Guy
btw - since it's a function I tried to pass the return value by reference to a another function (php one) and then set it, but it didn't work.
maybe I did it wrong
Guy
i understand the error of the = to a return value(by the way
it works in vbscript).
but, and it's a big one, since the vbscript com object is close to me , i can only use the function it opens - how can i make it work?
is there another way? (byref, set or anything else?)
ths code in vbscript :
objView.Field("fName") = "newValue"
but, and it's a big one, since the vbscript com object is close to me , i can only use the function it opens - how can i make it work?
is there another way? (byref, set or anything else?)
ths code in vbscript :
objView.Field("fName") = "newValue"