CLOSE DATABASES
OPEN DATABASE (HOME() + 'c:\diamondaccounti\inventory control')
&& Get rid of the space and limit your dbf and dbc files to 10 characters.
USE products && Opens Customer table
&& Try:
&& if !used('products')
&& use products
&& else
&& select (products)
&& endif
&& Also it is usually preferable to use the alias clause when opening a table and check the shared clause as well. If it is multi user, read up on that style of programming.
SET ORDER TO stocknumber
SEEK Thisform.Combo4.value
&& Try:
&& if !empty(Thisform.Combo4.value) AND type('Thisform.Combo4.value') == "N"
&& seek Thisform.Combo4.value
&& else
&& messagebox(Whatever)
&& endif
IF FOUND( )
Thisform.CHARGEPERKARAT1.VALUE = chargeperkarat
Thisform.MEASUREMENTS1.VALUE = measurements
Thisform.Combo3.VALUE = cut
Thisform.Combo2.VALUE = colors
Thisform.Combo1.VALUE = clarity
Thisform.PRODUCTDESCRIPTION1.VALUE = productdescription
Thisform.Text1.VALUE = date_entered
Thisform.Text2.VALUE = date_removed
ELSE
GOTO RECNO(0) && Use GO TOP
CLEAR
? 'Closest matching listing is ' + stocknumber
? 'Record number: ' + ALLTRIM(STR(RECNO( )))
ENDIF
Also, you can combine the functionality of seek - iffound() by using the seek() function instead of the command. x = seek(keyvalue,table) if x = .T. it found the record. Also check SET NEAR if you are also looking for the closest match. But that should never happen if your combobox is the true list of stock numbers. Also it would be more efficient to bind the controls to the data in the dataenvironment and simply do a seek then a refresh and your data would automatically be visible.
Eric Kleeman - EDS Consulting Services
MCP Visual FoxPro
MCSD C#.NET
Hua Hin Thailand
Los Angeles California