|
Dim strSelect As String
Dim strWhere As String
strSelect = ""
strWhere = ""
'判断要显示的字段
If Me.Check1 = True Then
strSelect = strSelect & "Email,"
End If
If Me.Check2 = True Then
strSelect = strSelect & "Add,"
End If
If Me.Check3 = True Then
strSelect = strSelect & "Ctc,"
End If
If Me.Check4 = True Then
strSelect = strSelect & "Region,"
End If
If Me.Check5 = True Then
strSelect = strSelect & "Tel,"
End If
If Me.Check6 = True Then
strSelect = strSelect & "Fax,"
End If
If Me.Check7 = True Then
strSelect = strSelect & "product,"
End If
If Me.Check8 = True Then
srSelect = strSelect & "brands,"
End If
If Me.Check9 = True Then
strSelect = strSelect & "Webseit,"
End If
If Me.Check10 = True Then
strSelect = strSelect & "Halle,"
End If
If Me.Check11 = True Then
srSelect = strSelect & "Stand,"
End If
If Me.Check12 = True Then
strSelect = strSelect & "Messe,"
End If
'判断选择条件
If Not IsNull(Me.Region) = True Then
strWhere = strWhere & "C_Info.Region = Me.Region AND "
End If
If Not IsNull(Me.Product) = True Then
strWhere = strWhere & "C_Info.Product = Me.Product AND "
End If
If Not IsNull(Me.Cname) = True Then
strWhere = strWhere & "C_Info.Cname = Me.Cname AND "
End If
If Len(strWhere) > 0 Then
'有输入条件
strWhere = Left(strWhere, Len(strWhere) - 5)
End If
If Len(strSelect) > 0 Then
'有查询条件
strSelect = Left(strWhere, Len(strWhere) - 1)
End If
我想做个如下查询
Select strSelect
From C_Info
Where strWhere
然后把结果动态生成一个窗体显示出来 |
|