当前位置: 代码迷 >> C语言 >> 急救~!!各位高手帮帮我吧~!!谢谢 谢谢
  详细解决方案

急救~!!各位高手帮帮我吧~!!谢谢 谢谢

热度:408   发布时间:2005-01-17 00:30:00.0
急救~!!各位高手帮帮我吧~!!谢谢 谢谢

这个是单表的查询窗体 语句在下面 里面有错误 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

搜索更多相关的解决方案: 急救  

----------------解决方案--------------------------------------------------------
老兄,这是什么语言?
----------------解决方案--------------------------------------------------------
VB//
----------------解决方案--------------------------------------------------------
晕,有什么好笑的?

没学过嘛

不过有点像Delphi

为什么那么多End Sub?
----------------解决方案--------------------------------------------------------
老兄你怎么把VB的程序弄到C语言里来了!
----------------解决方案--------------------------------------------------------
  相关解决方案