** NORMAS DEL FORO **
Inicio del foro Inicio del foro > Access y VBA > Access y VBA
  Mensajes nuevos Mensajes nuevos RSS - Proteger Base de Datos
  Preguntas frecuentes Preguntas frecuentes  Buscar en el foro   Eventos   Registro Registro  Iniciar sesion Iniciar sesion

Proteger Base de Datos

 Responder Responder
Autor
Mensaje
M3talzoneDGD Ver desplegable
Nuevo
Nuevo


Unido: 12/Febrero/2024
Localización: almeria
Estado: Sin conexión
Puntos: 46
Opciones de entrada Opciones de entrada   Gracias (0) Gracias(0)   Cita M3talzoneDGD Cita  ResponderRespuesta Enlace directo a este mensaje Tema: Proteger Base de Datos
    Enviado: 11/Junio/2024 a las 19:38
Buenas tardes

Lo mismo este tema está en algun post aclarado pero con la busqueda no lo he encontrada. El tema es que, yo tengo una BBDD de Access que comparto con otra persona, tengo el frontend y el backend. El tema es, para ingresar en la BBDD lo primero que se abre es un formulario de Login y dependiendo del user que se elija habre un menu u otro. Lo que me gustaria saber es, hay forma de que si el que entra en la BBDD no es el Administrador se desactive directamente el boton derecho del mouse? otra. Hay forma de proteger para que no abran la BBDD pulsadon la tecla Shift del teclado, o poner un password para poder acceder pulsando la tecla shift?

Muchas gracias por todo.

Arriba
mounir Ver desplegable
Colaborador
Colaborador


Unido: 09/Febrero/2009
Localización: Asturias-España
Estado: Sin conexión
Puntos: 6521
Opciones de entrada Opciones de entrada   Gracias (0) Gracias(0)   Cita mounir Cita  ResponderRespuesta Enlace directo a este mensaje Enviado: 12/Junio/2024 a las 11:15
Hola!

1- Para desactivar el botón derecho del mouse:-

https://learn.microsoft.com/es-es/office/vba/api/access.form.shortcutmenu

2- Crea un botón en un formulario menú por ejemplo y pon el evento ala hacer Clic:-

Private Sub Cmd_Mantenimiento_Click()
If InputBox("Clave?", "Bloqueo de BD") = "123456" Then
    ap_EnableShift
    
Else
    ap_DisableShift
    
End If
End Sub



Function ap_DisableShift()
'This function disable the shift at startup. This action causes
'the Autoexec macro and Startup properties to always be executed.

On Error GoTo errDisableShift

Dim db As DAO.Database
Dim prop As DAO.Property
Const conPropNotFound = 3270

Set db = CurrentDb()

'This next line disables the shift key on startup.
db.Properties("AllowByPassKey") = False

'The function is successful.
Exit Function

errDisableShift:
'The first part of this error routine creates the "AllowByPassKey
'property if it does not exist.
If Err = conPropNotFound Then
Set prop = db.CreateProperty("AllowByPassKey", _
dbBoolean, False)
db.Properties.Append prop
Resume Next
Else
MsgBox "Function 'ap_DisableShift' did not complete successfully."
Exit Function
End If

End Function

Function ap_EnableShift()
'This function enables the SHIFT key at startup. This action causes
'the Autoexec macro and the Startup properties to be bypassed
'if the user holds down the SHIFT key when the user opens the database.

On Error GoTo errEnableShift

Dim db As DAO.Database
Dim prop As DAO.Property
Const conPropNotFound = 3270

Set db = CurrentDb()

'This next line of code disables the SHIFT key on startup.
db.Properties("AllowByPassKey") = True

'function successful
Exit Function

errEnableShift:
'The first part of this error routine creates the "AllowByPassKey
'property if it does not exist.
If Err = conPropNotFound Then
Set prop = db.CreateProperty("AllowByPassKey", _
dbBoolean, True)
db.Properties.Append prop
Resume Next
Else
MsgBox "Function 'ap_DisableShift' did not complete successfully."
Exit Function
End If

End Function





Un Saludo.
Arriba
javier.mil Ver desplegable
Colaborador
Colaborador
Avatar

Unido: 10/Agosto/2005
Localización: España
Estado: Sin conexión
Puntos: 4856
Opciones de entrada Opciones de entrada   Gracias (0) Gracias(0)   Cita javier.mil Cita  ResponderRespuesta Enlace directo a este mensaje Enviado: 12/Junio/2024 a las 17:51
Pegale un vistazo la demo 4 de mi WEB
Arriba
 Responder Responder
  Compartir tema   

Ir al foro Permisos de foro Ver desplegable