You are on page 1of 1

Private Sub Form_Open(Cancel As Integer)

Dim f As Date
Dim hoy As Date
Dim usr As String

usr = InputBox("Introduzca el nombre de usuario", "Usuario", "Pepito de los Palotes")

If usr <> "*** MI CLAVE SECRETA ***" Then


AlterarPropriedade "AllowBypassKey", dbBoolean, False
Else
AlterarPropriedade "AllowBypassKey", dbBoolean, True
End If
' Bomba de tiempo
' f = "1/1/2005"
' hoy = Date
'
' If hoy > f Then
' MsgBox "producto en fase demo"
' DoCmd.Quit
' Else
' DoCmd.Close acForm, "inicio"
' End If
DoCmd.Close acForm, "inicio"
End Sub

Public Function AlterarPropriedade(strPropName As String, varPropType As Variant, varPropValue As Variant) As Integer


Dim dbs As dao.Database, prp As dao.Property

Const conPropNotFoundError = 3270


Set dbs = CurrentDb
On Error GoTo Change_Err
dbs.Properties(strPropName) = varPropValue
AlterarPropriedade = True
Change_Bye:
Exit Function
Change_Err:
If Err = conPropNotFoundError Then ' Propiedad no ha sido localizada.
Set prp = dbs.CreateProperty(strPropName, varPropType, varPropValue)
dbs.Properties.Append prp
Resume Next
Else
' Error desconocido.
AlterarPropriedade = False
Resume Change_Bye
End If
End Function
Tienes que activar la libreria Microsoft DAO 3.6 object library
Un saludo

You might also like