General information
Category:
Forms & Form designer
I have the same problem and solved it except when the field is blank as follows:
SELECT client
Found=.t.
Locate for client.clientnum=this.value
if !Found()
Found=.f.
endif
If Found
etc., etc.
I have no idea why this works and the other doesn't
------------------------------------------------------------
>I have a form that I need to be able to lookup a record from a different file (CLIENT) by 1 of 2 fields in the CLIENT file. The first, which works, is by CLIENT name which is selected from a combo. The combo is bound to the unique CLIENT id and is saved in the new file (LOG).
>
>The second way to locate the client is to key in a CLIENT number (different than the unique ID). I added a textbox to the form to allow possible input of the number. In processing the search of the matching CLIENT by number, I created a VALID method for the textbox and added this code....(the cbClient is the combo for the client name)...
>
>SELECT client
>Locate for client.clientnum=this.value
>if !Found()
> Messagebox("Client Number not found",48,"ERROR")
> return 0
>ELSE
> Thisform.pageframe1.page1.cbClient.Value=client.clientid
> return 1
>ENDIF
>
>
>
>
>I thought this would work and actually, it appears to be a hit or miss. By stepping through the code, the FOUND() returns a .T. even when a matching number is not found.
>
>I also tried to use the index for the CLIENT number and a SEEK() but when I tried to add a SET INDEX TO CLIENTNUM I got an error about table/cursor buffering which through me. (I still need to work on the buffering stuff for this app... right now everything is set for the defaults)
>
>Is there a way to have more than one INDEX available at a time on a form? Would I add multiple instances of the file in the DE and set the ORDER property differently or something similar?
>
>Suggestions?
Previous
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only