Public Function Test(StrCx As String, StrField As String) As Boolean
'StrCx 为查询名称
'StrField 为StrCX查询的字段名称
Dim Rs As New ADODB.Recordset
Dim Sql As String
Dim StrPath As String
StrPath = CurrentProject.Path & "\Data\db1.mdb"
Rs.ActiveConnection = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + Trim(StrPath) + ";"
Sql = "select * from " & StrCx & ""
Set Rs = Rs.ActiveConnection.Execute(Sql)
With Rs
If .EOF Then
Exit Function
End If
Do While Not .EOF
If .Fields(StrField) = "变量" Then
Test = True
End If
.MoveNext
Loop
.Close