试试这样:
cmd = "SELECT * FROM 兽药信息管理表 WHERE .T."
IF !EMPTY(ALLTRIM(thisform.Text1.value))
cmd = cmd + " AND 厂家 like %" + thisform.Text1.value + "%"
ENDIF
IF !EMPTY(ALLTRIM(thisform.Text2.value))
cmd = cmd + " AND 供应商 like %" + thisform.Text2.value + "%"
ENDIF
IF !EMPTY(ALLTRIM(thisform.Text3.value))
cmd = cmd + " AND 商品名 like %" + thisform.Text3.value + "%"
ENDIF
IF !EMPTY(ALLTRIM(thisform.Text4.value))
cmd = cmd + " AND 名称 like %" + thisform.Text4.value + "%"
ENDIF
cmd = cmd + " INTO TABLE jg.dbf"
EXECSCRIPT(cmd)
thisform.grid1,recordsource = "jg.dbf"