| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 655 人关注过本帖
标题:急救~!!各位高手帮帮我吧~!!谢谢 谢谢
只看楼主 加入收藏
bai1111
Rank: 1
等 级:新手上路
帖 子:8
专家分:0
注 册:2004-12-6
收藏
 问题点数:0 回复次数:4 
急救~!!各位高手帮帮我吧~!!谢谢 谢谢

这个是单表的查询窗体 语句在下面 里面有错误 Public s As String Dim a2 As String, a3 As String, a4 As String

Private Sub com1_Click() If text1.Value = "" Or cb2.Value = "" Or cb3.Value = "" Or text2.Value = "" Then MsgBox ("输入的全部值不可为空!") Else text2.SetFocus s = s + " AND " text2.Text = s com1.Enabled = False com2.Enabled = False com3.Enabled = True End If End Sub

Private Sub com2_Click() If text1.Value = "" Or cb2.Value = "" Or cb3.Value = "" Or text2.Value = "" Then MsgBox ("输入的全部值不可为空!") Else text2.SetFocus s = s + " OR " text2.Text = s com1.Enabled = False com2.Enabled = False com3.Enabled = True End If

End Sub

Private Sub com3_Click() cb2.SetFocus a2 = cb2.Text cb3.SetFocus a3 = cb3.Text text1.SetFocus a4 = text1.Text If a4 = "" Or a2 = "" Or a3 = "" Then MsgBox ("输入的全部值不可为空!") Else If cb2.Value = "采购员编号" Then 's = s + " " + a2 + " " + a3 + " " + "'" + "*" + a4 + "*" + "'" s = s + a2 + a3 + a4 ElseIf cb3 = "LIKE" Or cb3 = "NOT LIKE" Then s = s + " " + a2 + " " + a3 + " " + "'" + "*" + a4 + "*" + "'"

Else s = s + " " + a2 + " " + a3 + " " + "'" + a4 + "'" End If

text2.SetFocus text2.Text = s com1.Enabled = True com2.Enabled = True com3.Enabled = True End If

End Sub

Private Sub com4_Click() l1.RowSource = "SELECT * FROM 采购员资料表 WHERE " + s + ";"

If text2.Value = "" Then MsgBox ("请先按ADD键") End If

End Sub

Private Sub com5_Click()

s = "" text2.Value = "" text1.Value = "" cb2.Value = "" cb3.Value = "" l1.Value = "" l1.RowSource = "" com1.Enabled = False com2.Enabled = False

End Sub

Private Sub Form_Load() com1.Enabled = False com2.Enabled = False com3.Enabled = True

End Sub

Private Sub l1_BeforeUpdate(Cancel As Integer)

End Sub

Private Sub 主体_Click()

End Sub

Private Sub 关闭窗体_Click() On Error GoTo Err_关闭窗体_Click

DoCmd.Close

Exit_关闭窗体_Click: Exit Sub

Err_关闭窗体_Click: MsgBox Err.Description Resume Exit_关闭窗体_Click End Sub

这个是多表的查询窗体图 多表的语句现在就查一个判断字段类型的函数了

Public s As String Dim a2 As String, a3 As String, a4 As String

Private Sub com1_Click() If text1.Value = "" Or cb2.Value = "" Or cb3.Value = "" Or text2.Value = "" Then MsgBox ("输入的全部值不可为空!") Else text2.SetFocus s = s + " AND " text2.Text = s com1.Enabled = False com2.Enabled = False com3.Enabled = True End If End Sub

Private Sub com2_Click() If text1.Value = "" Or cb2.Value = "" Or cb3.Value = "" Or text2.Value = "" Then MsgBox ("输入的全部值不可为空!") Else text2.SetFocus s = s + " OR " text2.Text = s com1.Enabled = False com2.Enabled = False com3.Enabled = True End If

End Sub

Private Sub com3_Click() cb2.SetFocus a2 = cb2.Text cb3.SetFocus a3 = cb3.Text text1.SetFocus a4 = text1.Text If a4 = "" Or a2 = "" Or a3 = "" Then MsgBox ("输入的全部值不可为空!") Else If cb2.Value = "采购员编号" Or cb2.Value = "仓库编号" Or cb2.Value = "库存量" Then 's = s + " " + a2 + " " + a3 + " " + "'" + "*" + a4 + "*" + "'" s = s + a2 + a3 + a4 ElseIf cb3 = "LIKE" Or cb3 = "NOT LIKE" Then s = s + " " + a2 + " " + a3 + " " + "'" + "*" + a4 + "*" + "'"

Else s = s + " " + a2 + " " + a3 + " " + "'" + a4 + "'" End If

text2.SetFocus text2.Text = s com1.Enabled = True com2.Enabled = True com3.Enabled = True End If

End Sub

Private Sub com4_Click() l1.RowSource = "SELECT * FROM 查询1 WHERE " + s + ";"

If text2.Value = "" Then MsgBox ("请先按ADD键") End If

End Sub

Private Sub com5_Click()

s = "" text2.Value = "" text1.Value = "" cb2.Value = "" cb3.Value = "" l1.Value = "" l1.RowSource = "" com1.Enabled = False com2.Enabled = False

End Sub

Private Sub Form_Load() com1.Enabled = False com2.Enabled = False com3.Enabled = True

End Sub

Private Sub l1_BeforeUpdate(Cancel As Integer)

End Sub

Private Sub 主体_Click()

End Sub

Private Sub 关闭窗体_Click() On Error GoTo Err_关闭窗体_Click

DoCmd.Close

Exit_关闭窗体_Click: Exit Sub

Err_关闭窗体_Click: MsgBox Err.Description Resume Exit_关闭窗体_Click End Sub

搜索更多相关主题的帖子: 急救 
2005-01-17 00:30
空前
Rank: 1
等 级:新手上路
帖 子:1146
专家分:0
注 册:2004-5-11
收藏
得分:0 
老兄,这是什么语言?

2005-01-17 09:48
aniude
Rank: 2
等 级:新手上路
威 望:3
帖 子:231
专家分:0
注 册:2004-11-3
收藏
得分:0 
VB//

2005-01-17 11:04
空前
Rank: 1
等 级:新手上路
帖 子:1146
专家分:0
注 册:2004-5-11
收藏
得分:0 
晕,有什么好笑的?

没学过嘛

不过有点像Delphi

为什么那么多End Sub?

2005-01-17 11:08
ysscd2004
Rank: 1
等 级:新手上路
帖 子:5
专家分:0
注 册:2005-2-27
收藏
得分:0 
老兄你怎么把VB的程序弄到C语言里来了!
2005-03-06 12:44
快速回复:急救~!!各位高手帮帮我吧~!!谢谢 谢谢
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.017075 second(s), 9 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved