Function paswd1()
Dim strSelect As String
Dim strFrom As String
Dim strWhere As String
Dim qqq As String
Dim www As String
Dim strsql As String
Dim dbs As Database
Dim qdf As QueryDef
Dim con As Connection
Dim wrkODBC As Workspace
strSelect = "SELECT "
strSelect = strSelect & "pas.id, pas.idparol, pas.iduser, pas.idrole, pas.idnaim"
strFrom = " FROM pas"
strWhere = " WHERE true"
If Nz([Form_Avtorizaciy].[Пароль], 0) > 0 Then qqq = [Form_Avtorizaciy].[Пароль]
If Nz([Form_Avtorizaciy].[Логин], 0) > 0 Then www = [Form_Avtorizaciy].[Логин]
If Nz(qqq, 0) > 0 Then strWhere = strWhere & " and pas.idparol = " & """" & qqq & """"
If Nz(www, 0) > 0 Then strWhere = strWhere & " and pas.iduser = " & """" & www & """"
Set wrkODBC = CreateWorkspace("NewODBCWorkspace", "admin", "", dbUseODBC)
Set con = wrkODBC.OpenConnection("apexodbc", dbDriverNoPrompt, , "ODBC;DATABASE=apexDB;")
strsql = strSelect & strFrom & strWhere & ";"
con.QueryDefs("password").SQL = strsql
con.Close
wrkODBC.Close
End Function
|