Excel精英培训网

 找回密码
 注册
数据透视表40+个常用小技巧,让你一次学会!
查看: 1712|回复: 4

[已解决]求助完善

[复制链接]
发表于 2013-4-19 18:28 | 显示全部楼层 |阅读模式
求助:
   1.将两个时间段查询编辑插在Private Sub CommandButton1_Click()里与 If InStr(.Cells(i, 3), TextBox1.Text) And InStr(.Cells(i, 6).Value, TextBox2.Text) > 0 Then形成一个多级查询。
   2.窗体/“添加”和“修改”功能编辑需帮助

       注:“添加”功能实际和录入信息意思基本一样
               “修改”功能就是在结果查询完成时能够修改数据库信息。

   小弟和学生 再次谢过了。
最佳答案
2013-4-19 21:13
厚成泰克 纳品信息.rar (29.32 KB, 下载次数: 6)

厚成泰克 纳品信息.rar

22.22 KB, 下载次数: 5

发表于 2013-4-19 20:18 | 显示全部楼层
问题一是啥意思,将两个时间段查询编辑插在Private Sub CommandButton1_Click()里与 If InStr(.Cells(i, 3), TextBox1.Text) And InStr(.Cells(i, 6).Value, TextBox2.Text) > 0 Then形成一个多级查询。

解释下,看不明白。
回复

使用道具 举报

发表于 2013-4-19 20:26 | 显示全部楼层
问题一,查找
  1. Private Sub CommandButton1_Click()
  2.     Dim dateStart As Date
  3.     Dim dateEnd As Date
  4.     If Me.DTPicker2.Value < Me.DTPicker1.Value Then
  5.         MsgBox "结束时间小于起始时间"
  6.         Exit Sub
  7.     End If
  8.     dateStart = Me.DTPicker1.Value
  9.     dateEnd = Me.DTPicker2.Value
  10.     ListView1.ListItems.Clear
  11.     With Sheets("sheet1")
  12.         For i = 4 To .[B65536].End(xlUp).Row
  13.             If InStr(.Cells(i, 3), TextBox1.Text) And InStr(.Cells(i, 6).Value, TextBox2.Text) > 0 And .Cells(i, 8) >= dateStart And .Cells(i, 8) <= dateEnd Then
  14.                 Set itm = ListView1.ListItems.Add()
  15.                 itm.Text = .Cells(i, 2)
  16.                 itm.SubItems(1) = .Cells(i, 3)
  17.                 itm.SubItems(2) = .Cells(i, 4)
  18.                 itm.SubItems(3) = .Cells(i, 5)
  19.                 itm.SubItems(4) = .Cells(i, 6)
  20.                 itm.SubItems(5) = .Cells(i, 7)
  21.                 itm.SubItems(6) = .Cells(i, 8)
  22.                 itm.SubItems(7) = .Cells(i, 9)
  23.             End If
  24.         Next i
  25.         If ListView1.ListItems.Count = 0 Then MsgBox "未查询到相关记录!", 64, "结果"
  26.     End With
  27. End Sub
复制代码
回复

使用道具 举报

发表于 2013-4-19 20:51 | 显示全部楼层
修改是直接修改窗体列表下面的那一排么?
回复

使用道具 举报

发表于 2013-4-19 21:13 | 显示全部楼层    本楼为最佳答案   
厚成泰克 纳品信息.rar (29.32 KB, 下载次数: 6)
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|Archiver|Excel精英培训 ( 豫ICP备11015029号 )

GMT+8, 2024-3-29 06:16 , Processed in 0.801836 second(s), 9 queries , Gzip On, Yac On.

Powered by Discuz! X3.4

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表