|
I will write below the code which i have problems with, error that shows is some parameters are not define.
Dim USER As String
Dim pswd As String
Dim userfromfrm As String
Dim pswfromfrm As String
Dim stDocName As String
Dim ArgSQL As String
Option Compare Database
Private Sub botrunmacro_Click()
' On Error GoTo Err_botrunmacro_Click
' TOMNO LOS VALORES DE LOS OBJETOS DEL FORM
userfromfrm = Form_FrmRunMacro.user01.Value
pswfromfrm = Form_FrmRunMacro.psw01.Value
' TENGO QUE RECUPERAR LOS VALORES DE LA TABLA
USER = Form_FrmRunMacro.Usuario.Value
pswd = Form_FrmRunMacro.ClavedeAcceso.Value
ArgSQL = "SELECT Usuario, Clavedeacceso from TBLUSUARIOS where TBLUSUARIOS.Usuario=" & userfromfrm & " & TBLUSUARIOS.ClaveDeAcceso =" & pswfromfrm & ";"
Dim con As New ADODB.Connection
Dim USUS01 As ADODB.Field
Set con = Application.CurrentProject.Connection
Set rs = CreateObject("ADODB.RecordSet")
rs.Open ArgSQL, con, adOpenForwardOnly, adLockReadOnly, adCmdText
Do Until rs.EOF
USUS01 = rs.Fields("USUARIO").Value
For Each USUS01 In rs.Fields
Select Case USUS01
Case "OPCODE "
stDocName = "MACROOPENOPCODE"
End
Case "OPVTAGRAL"
stDocName = "MACROOPENOPVTAGRAL"
End
Case "USUARIOBASE"
stDocName = "MACROOPENUSUARIOBASE"
End
Case "ADMINISTRADOR"
stDocName = "MACROOPENUSUARIOBASE"
End
Case ""
MsgBox ("Debe ingresar usuartio y clave validos")
End
Case " "
MsgBox ("Debe ingresar usuartio y clave validos")
End
End Select
DoCmd.RunMacro stDocName
Next
rs.MoveNext
Loop
rs.Close
con.Close
Set rs = Nothing
Set con = Nothing
End Sub
'------------
I will apreciate your answer.
|