以文本方式查看主题 - Foxtable(狐表) (http://foxtable.com/bbs/index.asp) -- 专家坐堂 (http://foxtable.com/bbs/list.asp?boardid=2) ---- 请问老师,查询窗口的年和月代码怎么写 (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=136726) |
-- 作者:jingledyang -- 发布时间:2019/6/19 23:21:00 -- 请问老师,查询窗口的年和月代码怎么写 请问老师,根据注册码,姓名,公司名称,来查询一个人在某年某月的工资,这代码怎么写? ![]() ![]() |
-- 作者:有点甜 -- 发布时间:2019/6/19 23:24:00 -- 参考
http://www.foxtable.com/webhelp/topics/2720.htm
|
-- 作者:jingledyang -- 发布时间:2019/6/21 23:31:00 -- 老师,我想能像“姓名”box和"公司名称“box的代码实现的功能那样,但是“工作日期”是日期型,不知道如何转换然后显示出来,就像加载树那样的功能。
下面是窗口AfterLoad事件代码 Dim cmb As WinForm.ComboBox = e.form.Controls("ComID")
下面是“姓名”box的代码
Dim cmb As WinForm.ComboBox = e.Sender
下面是“公司名称”box的代码,
Dim cmb As WinForm.ComboBox = e.Sender |
-- 作者:有点蓝 -- 发布时间:2019/6/22 9:09:00 -- 月就12个月,直接写死就行了:cmb.ComboList = "1|2|3|.....|12" 年也一样,把最近20年写进去就差不多了 dim m as integer = val(e.form.controls("月textbox").text) dim d as date = new date(y,m,1)
|
-- 作者:jingledyang -- 发布时间:2019/6/22 22:35:00 -- 老师,您给的方案我觉得不太科学,因为一个人在一家公司工作的年月时间存在不稳定性。不能去查找不存在的记录,这样系统可能会出错,还会给操作带来负担。要像加载树那样,有记录才查。工厂用的ERP系统,也是这样了的。 ![]() ![]() [此贴子已经被作者于2019/6/22 22:38:42编辑过]
|
-- 作者:有点甜 -- 发布时间:2019/6/23 11:36:00 -- 比如
Dim cmb As WinForm.ComboBox = e.Sender Dim str2 As String = e.Form.Controls("ComID").Value |
-- 作者:jingledyang -- 发布时间:2019/6/23 23:09:00 -- 老师,您今天给的方法我之前试过了的出现以下错误,可否把日期类型做为String类型。 ![]() ![]() |
-- 作者:有点甜 -- 发布时间:2019/6/24 10:36:00 --
年、月 控件,请改成combobox类型,不要用下拉日期
|
-- 作者:jingledyang -- 发布时间:2019/6/24 23:04:00 -- 我把年,月从日期类型改为Combobox,但是查询代码执行不了。我知道有问题,但是不知道如何修改代码。
Dim Filter As String
![]() ![]() |
-- 作者:有点蓝 -- 发布时间:2019/6/24 23:17:00 -- …… With e.Form.Controls("ComLtd") If .Value IsNot Nothing Then If Filter >"" Then Filter = Filter & " And " End If Filter = Filter & "公司名称 = \'" & .Value & "\'" End If End With Dim y As Integer = val(e.form.controls("yDate").text) Dim m As Integer = val(e.form.controls("mDate").text) If y > 0 If m > 0 Then Dim d As Date = new Date(y,m,1) Filter = Filter & "工作日期 >= #" & d & "# and 工作日期 < #" & d.AddMonths(1) & "#" Else Dim d As Date = new Date(y,1,1) Filter = Filter & "工作日期 >= #" & d & "# and 工作日期 < #" & d.AddYears(1) & "#" End If End If Tables("考勤日记").Filter = Filter |