做查询表单,请帮帮忙

guanxe 2007-12-14 10:34:26
我要做一个表单包括一个下拉列表框用来显示员工姓名,两个文本框用来输出起始日期,一个按钮,这个表单主要实现目的是:查找列表框中选中的员工在该段时间内的工作内容,将查询结果用先设计好的hz.frx报表打印出来,发到每个人手中,我现在能实现将员工姓名显示在列表框中.谁能帮帮我,我其余的该怎样做?在这里我先谢谢您了
...全文
65 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
十豆三 2007-12-14
  • 打赏
  • 举报
回复
先参考一些例子吧。

http://www.vfptop.com/dmfs.asp
http://hi.baidu.com/chinavfp/blog/item/109da4516f55e42542a75b98.html
这里有免费代码放送
十月鹰飞 2007-12-14
  • 打赏
  • 举报
回复
*以下是一代示例代码.
local strSqlQuery
local strSqlWhere,strSqlCondition
strSqlQuery="select * from <yourtable>.dbf"
strSqlWhere=""
strSqlCondition=""
if not empty(thisform.txtName.value)
strSqlWhere="where name='"
strSqlWhere=strSqlWhere+alltrim(thisform.txtName.value)+"'"
else
strSqlWhere=""
endif
*假设必须输入日期,此处可根据需要作相应修改.
if empty(thisform.txtFromDate.value) xor (thisform.txtToDate.value)
messagebox("日期选项不可只填一项",64,"出错")
return
endif
*此处假设日期框内数据已经为日期类型,在实际应用时,应该进行类型检查.
strSqlCondition="dt_work>="+dtoc(thisform.txtFromDate.value) +"and dt_work<="+dtoc(thisform.txtFromDate.value)
if empty(strSqlWhere)
strSqlWhere="where"+space(1)
strSqlWhere=strSqlWhere+strSqlCondition
else
strSqlWhere=strSqlWhere+space(1)
strSqlWhere=strSqlWhere+"and"
strSqlWhere=strSqlWhere+space(1)+strSqlCondition
endif
strSqlQuery=strSqlQuery+space(1)+strSqlWhere
strSqlQuery=strSqlQuery+space(1)+"into table ab.dbf" //此处也可以为cursor,不过为了方便制作报表,还是用表.只是记得erase一下就可以了.这个表就是你的hs.frx的报表数据环境
=execscript(strSqlQuery) *也可以用宏替换,但从代码可读性上考虑,建议用该函数.
report form hz.frx preview
十月鹰飞 2007-12-14
  • 打赏
  • 举报
回复
用条件生成SQL语句,注意要将结果输出到一个表或临时表中.然后用宏代换或execscript函数执行该语句,然后用报表打印就可以了.

2,749

社区成员

发帖
与我相关
我的任务
社区描述
VFP,是Microsoft公司推出的数据库开发软件,用它来开发数据库,既简单又方便。
社区管理员
  • VFP社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧