Annonnymus


i got this code:

x=RECCOUNT()

DO WHILE (RECNO()+1<x)

IF stop=1

EXIT

ENDIF

nui=ATc(def,var1) &&the prob

IF (nui>0)

thisform.list2.additem(cuv)

ENDIF

SKIP

enddo

nui is >0 only for the first check ;after that it always returns 0,and several of my def (memo) values contain var1



Re: stupid (?!?) function

Zografski


GO TOP

DO WHILE NOT EOF()

IF stop=1

EXIT

ENDIF

***nui=ATc(def , var1) &&t he prob

nui=ATC(var1, def ) &&& ;o)

IF (nui>0)

thisform.list2.additem(cuv)

ENDIF

SKIP

ENDDO






Re: stupid (?!?) function

Naomi Nosonovsky

Instead of DO WHILE it's better to use SCAN/ENDSCAN if you need to process the whole table.

Try

Code Snippet

scan

if var1 $ MyTable.def && assuming def is a memo field

thisform.list2.additem(cuv) && What we're doing here

endif

endscan

In your code it looks like you misplaced parameters in ATC function.






Re: stupid (?!?) function

CetinBasoz

Scan While (Recno()+1<Reccount()) And stop != 1

If Atc(m.var1,def)>0

Thisform.list2.AddItem(cuv)

Endif

Endscan





Re: stupid (?!?) function

CetinBasoz

Naomi,

$ operator wouldn't work instead of Atc().

He wants to exclude last record.

Stop (whatever it's, probably a field) has some importance in his code but you ignored.

PS: AddItem() add a new item to a listbox/combobox. See in help for more details.





Re: stupid (?!?) function

Naomi Nosonovsky

I see, I guess I didn't look very close on this code - no comments, hard to grasp. I know, what AddItem does, but just wanted to find, what is the purpose of the code, why do we need to add some field value to a ListBox.

I guess, it would help if the thread originator gives us the idea of what this code is supposed to do.