Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Y2KO'ed by Comboboxes!
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00313319
Message ID:
00313941
Views:
46
Steve,

Two things wrong 1) you are changing work area without restoring it. 2) the outermost if will ALWAYS be true! You've mixed negative logic with OR. This means that if the DisplayValue is 0 it'll be .f. in the first condition, but .t. in all the others. The same thing happens for any value 0-9 or any alpha character. Are you wanting the SEEK code to run if the value to be between 0-9 inclusive or when it's outside that range?

This chunk of code might work better (assuming inside the range 0-9, use a NOT this.DisplayValue $ ... otherwise):
if ( this.DisplayValue $ "0123456789" )
   SEEKID = ALLT(THISFORM.cbo_unit_type1.DisplayValue)
   if ( seek( seekid, "aed_info", "unitid" ) )
      THISFORM.txtAEDID1.Value = aed_info.aedid
      THISFORM.cboAED1.Value = ""
   ELSE
      THISFORM.txtAEDID1.Value = "N/A"
      THISFORM.cboAED1.Value = "N"
   ENDIF
ENDIF
endif
>David,
>
>I found it has something to do with the code in my Valid(), but not the REPLACE command, but everything after the REPLACE command. When I commented out the rest of the code in the Valid() after the REPLACE command, everything worked. I will have to move or rewrite the code after the REPLACE command. Thanks for your assistance.
>
>This is all of the code in my Valid():
>
>REPLACE arrest.unit_type1 WITH ALLTRIM(THIS.DisplayValue)
>
>IF THIS.DisplayValue != "0" OR ;
> THIS.DisplayValue != "1" OR ;
> THIS.DisplayValue != "2" OR ;
> THIS.DisplayValue != "3" OR ;
> THIS.DisplayValue != "4" OR ;
> THIS.DisplayValue != "5" OR ;
> THIS.DisplayValue != "6" OR ;
> THIS.DisplayValue != "7" OR ;
> THIS.DisplayValue != "8" OR ;
> THIS.DisplayValue != "9"
> SEEKID = ALLT(THISFORM.cbo_unit_type1.DisplayValue)
> SELECT aed_info
> SET ORDER TO unitid
> SEEK SEEKID
> IF FOUND()
> THISFORM.txtAEDID1.Value = aed_info.aedid
> THISFORM.cboAED1.Value = ""
> ELSE
> THISFORM.txtAEDID1.Value = "N/A"
> THISFORM.cboAED1.Value = "N"
> ENDIF
>ENDIF
df (was a 10 time MVP)

df FoxPro website
FoxPro Wiki site online, editable knowledgebase
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform