Hi,
Thirs any whay of converting a string to command button object.
I have this function, and i need to use the string paramenter aButton as a command button:
Sub desactivaMenu(aTipoUser As Integer, aObjecto As String, aButton As String)
Dim RSAcessos As DAO.Recordset
Dim Dbs As Database
Dim StrSql As String
Dim tipoAcesso As Integer
Dim tObj As Form
Dim tCmd As Variant -> the problem is hear
Set tCmd = aBotao -> the problem is hear
Set tObj = Forms!ecranPrincipal.Form
'BD a ser utilizada é a actual
Set Dbs = CurrentDb()
StrSql = "select * from acessos where TipoUtilizador=" & aTipoUser & " and objecto='" & aObjecto & "'"
Set RSAcessos = Dbs.OpenRecordset(StrSql, dbOpenSnapshot, dbReadOnly)
If Not RSAcessos.EOF Then
tipoAcesso = RSAcessos("tipoAcesso")
Else
tipoAcesso = 0
End If
If tipoAcesso = 3 And tObj.Name = "ecranPrincipal" Then
tObj.tCmd.Enabled = False
Forms!ecranPrincipal![central].SourceObject = "F_vazio"
End If
RSAcessos.Close
Set Dbs = Nothing
End Sub
Thanks
Albano
Thirs any whay of converting a string to command button object.
I have this function, and i need to use the string paramenter aButton as a command button:
Sub desactivaMenu(aTipoUser As Integer, aObjecto As String, aButton As String)
Dim RSAcessos As DAO.Recordset
Dim Dbs As Database
Dim StrSql As String
Dim tipoAcesso As Integer
Dim tObj As Form
Dim tCmd As Variant -> the problem is hear
Set tCmd = aBotao -> the problem is hear
Set tObj = Forms!ecranPrincipal.Form
'BD a ser utilizada é a actual
Set Dbs = CurrentDb()
StrSql = "select * from acessos where TipoUtilizador=" & aTipoUser & " and objecto='" & aObjecto & "'"
Set RSAcessos = Dbs.OpenRecordset(StrSql, dbOpenSnapshot, dbReadOnly)
If Not RSAcessos.EOF Then
tipoAcesso = RSAcessos("tipoAcesso")
Else
tipoAcesso = 0
End If
If tipoAcesso = 3 And tObj.Name = "ecranPrincipal" Then
tObj.tCmd.Enabled = False
Forms!ecranPrincipal![central].SourceObject = "F_vazio"
End If
RSAcessos.Close
Set Dbs = Nothing
End Sub
Thanks
Albano