请教:VB6 一个查询框如何对 accsee不同的表进行同一查询(在线等待)
我现在可以在不同窗体 内对 一个123.mdb内不同表的查询但我想用一个窗体 对123.mdb内不同表的查询
应该如何设置
请各位高人,能让我一次到位
希望发简单的源文件(只包含该内容)源文件(还有accsee)可以运行,不然我担心自己看不懂,
邮件地址:kq17_huang@
cboType combobox带下拉框 还可以输入内容 按查询就可以实现相关内容的查询
以下是我查找按钮上的代码
Private Sub cmdFind_Click()
Dim strSQL As String
Dim strCon(6) As String
Dim intCount As Integer
Dim i As Integer
intCount = 0
'获得所有得查询条件
If txtBookID.Text <> "" Then
If chkMoHu.Value = 1 Then
strCon(1) = "定货号 like '%" & txtBookID.Text & "%'"
Else
strCon(1) = "定货号='" & txtBookID.Text & "'"
End If
Else
strCon(1) = ""
End If
If txtBookName.Text <> "" Then
If chkMoHu.Value = 1 Then
strCon(2) = "产品名称 like '%" & txtBookName.Text & "%'"
Else
strCon(2) = "产品名称='" & txtBookName.Text & "'"
End If
Else
strCon(2) = ""
End If
If cboType.Text <> "" Then
If chkMoHu.Value = 1 Then
strCon(3) = "类别代码 like '%" & Mid(cboType.Text, 1, 1) & "%'"
Else
strCon(3) = "类别代码='" & Mid(cboType.Text, 1, 1) & "'"
End If
Else
strCon(3) = ""
End If
If strCon(1) = "" And strCon(2) = "" And strCon(3) = "" And strCon(4) = "" And strCon(5) = "" And strCon(6) = "" Then
strSQL = "select * from 仪器目录"
Else
strSQL = "select * from 仪器目录 where "
For i = 1 To 6
If strCon(i) <> "" Then
intCount = intCount + 1
If intCount = 1 Then
strSQL = strSQL + strCon(i)
Else
strSQL = strSQL + " and " + strCon(i)
End If
End If
Next
End If
Adodc1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\产品库.mdb;Persist Security Info=False"
Adodc1.CursorLocation = adUseClient
= adCmdText
Adodc1.RecordSource = strSQL
Adodc1.Refresh
End Sub