文件打开及grid显示问题
在线等初学者,请指教,谢谢!
以下代码放在command的click中:
bdlr_mulu1=thisform.Text_sr_y.value
bdlr_mulu2=thisform.Text_sr_m.value
bdlr_mulu3=thisform.Text_sr_D.value
IF !DIRECTORY("D:\jjbd\"+alltrim(str(bdlr_mulu1))) &&不存在
MD "D:\jjbd\"+alltrim(str(bdlr_mulu1)) &&创建jjbd\str(bdlr_mulu1)文件夹
MD "D:\jjbd\"+alltrim(str(bdlr_mulu1))+"\M"+alltrim(str(bdlr_mulu2)) &&创建jjbd\mulu1\mulu2文件夹
ELSE
IF !DIRECTORY("D:\jjbd\"+alltrim(str(bdlr_mulu1))+"\M"+alltrim(str(bdlr_mulu2)))&&不存在
MD "D:\jjbd\"+alltrim(str(bdlr_mulu1))+"\M"+alltrim(str(bdlr_mulu2)) &&创建jjbd\mulu1\mulu2文件夹
ENDIF
ENDIF
**判断文件是否存在
if file("D:\jjbd\"+alltrim(str(bdlr_mulu1))+"\M"+alltrim(str(bdlr_mulu2))+"\D"+alltrim(STR(bdlr_mulu3))+".dbf") then
**[文件存在]
ELSE
COPY FILE "D:\jjbd\bf\表bdlr.dbf"to"D:\jjbd\"+alltrim(str(bdlr_mulu1))+"\M"+alltrim(str(bdlr_mulu2))+"\D"+alltrim(str(bdlr_mulu3))+".dbf"
endif
thisform.grid1.RecordSource=null
IF NOT USED("D:\jjbd\"+alltrim(str(bdlr_mulu1))+"\M"+alltrim(str(bdlr_mulu2))+"\D"+alltrim(str(bdlr_mulu3)))
use "D:\jjbd\"+alltrim(str(bdlr_mulu1))+"\M"+alltrim(str(bdlr_mulu2))+"\D"+alltrim(str(bdlr_mulu3))+".dbf"
else
sele "D:\jjbd\"+alltrim(str(bdlr_mulu1))+"\M"+alltrim(str(bdlr_mulu2))+"\D"+alltrim(str(bdlr_mulu3))
ENDIF
APPEND blank
...............
**再清除表单内容
Thisform.GRID1.RecordSourceType = 1
thisform.grid1.RecordSource="表ls"
THISFORM.grid1.BackColor=RGB(255,255,255)
thisform.grid1.Column1.width=30
thisform.grid1.Column2.width=180
thisform.grid1.refresh
第一次按command没问题,再次录入数据,第二次按command,会出现两个问题:
1、提示 use "D:\jjbd\"+alltrim(str(bdlr_mulu1))+"\M"+alltrim(str(bdlr_mulu2))+"\D"+alltrim(str(bdlr_mulu3))+".dbf" 已经打开
2、grid1 不显示内容,只有表格线(绑定表为"表ls")
之前有过这样代码:
PUBLIC MM
MM=this.Value
THISFORM.grid1.SetAll("DynamicBackColor","IIF(sry=MM,rgb(255,0,0),rgb(255,255,255))", "Column")
THISFORM.grid1.Refresh
为了实现上面的功能,grid1就不显示数据了