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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

"Variable not found" when try to scroll grid 2

Status
Not open for further replies.

shelbytll

Programmer
Dec 7, 2001
135
SG
I have use a View for my grid control.
I have set the SendUpdate.
On Init() , I set: this.recordsource=""
On the click() of a combo box, I code:

b=thisform.brand.value
m=thisform.model.value
select view1
set filter to brand=b
locate
thisform.grid1.recordsource="view1"
thisform.grid1.refresh


The result:
Upon selecting the combo box, the grid focus on the portion that I want. However, when I try to scroll up or down, the error say "Variable b is not found".

Did I do it the wrong way? Please advice. Thanks. I am a clever newbie...[peace]
 
HI
On the click of the combo.. you have the code..

b=thisform.brand.value
m=thisform.model.value

and you are using it to filter the view1

In order that the filter can be used by the table, the variable b and m has to be available ... however... the momemt you leave the combo.. these are not available ( b and m are local variables for that combo).

So to make it work.. create 2 form level property..
bVar and mVar and initialise their values with the character type or numeric type or whatever as the field type goes.

Now replace the click event code..
ThisForm.bvar = thisform.brand.value
ThisForm.mvar = thisform.model.value
select view1
set filter to brand=ThisForm.bVar

(I dont know how you use mVar..)

This will not create the problem.
Hope this helps you :) ramani :)
(Subramanian.G),FoxAcc, ramani_g@yahoo.com
 
shelbytll

Asside from Ramani's suggestion, you could try making your "b" (although I would avoid single letter variables) variable public.
Code:
PUBLIC b1 && At least two characters
b1=thisform.brand.value
m=thisform.model.value
select view1
set filter to brand=b1
locate
thisform.grid1.recordsource="view1"
thisform.grid1.refresh

Mike Gagnon
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top