📄 module_查询通讯录.bas
字号:
Attribute VB_Name = "Module_查询通讯录"
Sub 查询通讯录()
With 通讯录查询与打印
'生成sql语句
sqlstring = "SELECT 通讯录维护表.帐号,通讯录分组表.分组名称 AS 分组, 通讯录维护表.姓名, 性别代码表.性别名称 AS 性别, 通讯录维护表.固定电话, 通讯录维护表.移动电话, 通讯录维护表.email, 通讯录维护表.qq, 省市代码表.省市名称, 通讯录维护表.通讯地址, 通讯录维护表.通讯录代码 FROM 性别代码表, 通讯录维护表, 省市代码表, 通讯录分组表 WHERE 性别代码表.性别代码 = 通讯录维护表.性别代码 AND 通讯录维护表.省市代码 = 省市代码表.省市代码 AND 通讯录维护表.分组代码 = 通讯录分组表.分组代码 and 通讯录维护表.帐号= '" & 登陆帐号 & "'"
If Len(Trim(.DataCombo分组.Text)) > 0 Then
sqlstring = sqlstring + " and 通讯录维护表.分组代码= " + Trim(.DataCombo分组.BoundText)
End If
If Len(Trim(.txt姓名.Text)) > 0 Then
sqlstring = sqlstring + " and 姓名= '" + Trim(.txt姓名.Text) + "'"
End If
If Len(Trim(.DataCombo性别.BoundText)) > 0 Then
sqlstring = sqlstring + " and 通讯录维护表.性别代码= '" + Trim(.DataCombo性别.BoundText) + "'"
End If
If Len(Trim(.txt固定电话.Text)) > 0 Then
sqlstring = sqlstring + " and 固定电话= '" + Trim(.txt固定电话.Text) + "'"
End If
If Len(Trim(.txt移动电话.Text)) > 0 Then
sqlstring = sqlstring + " and 移动电话= '" + Trim(.txt移动电话.Text) + "'"
End If
If Len(Trim(.txtemail.Text)) > 0 Then
sqlstring = sqlstring + " and email= '" + Trim(.txtemail.Text) + "'"
End If
If Len(Trim(.txtemail.Text)) > 0 Then
sqlstring = sqlstring + " and qq= '" + Trim(.txtqq.Text) + "'"
End If
If Len(Trim(.DataCombo省市名称.BoundText)) > 0 Then
sqlstring = sqlstring + " and 通讯录维护表.省市代码= '" + Trim(.DataCombo省市名称.BoundText) + "'"
End If
If Len(Trim(.txt通讯地址.Text)) > 0 Then
sqlstring = sqlstring + " and 通讯地址= '" + Trim(.txt通讯地址.Text) + "'"
End If
'执行查询语句
DataEnvironment1.Commands("Com通讯录查询").CommandText = sqlstring
DataEnvironment1.Commands("Com通讯录查询").Execute
DataEnvironment1.rsCom通讯录查询.Requery
Set .DataGrid1.DataSource = DataEnvironment1
End With
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -