加密: 不用密碼,用權限,在登錄時存On_load加入 Option Compare Database Sub SetStartupProperties() Const DB_Text As Long = 10 Const DB_Boolean As Long = 1 ChangeProperty "StartupForm", DB_Text, "Customers" ChangeProperty "StartupShowDBWindow", DB_Boolean, False ChangeProperty "StartupShowStatusBar", DB_Boolean, False ChangeProperty "AllowBuiltinToolbars", DB_Boolean, False ChangeProperty "AllowFullMenus", DB_Boolean, True ChangeProperty "AllowBreakIntoCode", DB_Boolean, False ChangeProperty "AllowSpecialKeys", DB_Boolean, True ChangeProperty "AllowBypassKey", DB_Boolean, True End SubFunction ChangeProperty(strPropName As String, varPropType As Variant, varPropValue As Variant) As Integer Dim dbs As Object, prp As Variant Const conPropNotFoundError = 3270 Set dbs = CurrentDb On Error GoTo Change_Err dbs.Properties(strPropName) = varPropValue ChangeProperty = TrueChange_Bye: Exit FunctionChange_Err: If Err = conPropNotFoundError Then ' 找不到屬性。 Set prp = dbs.CreateProperty(strPropName, _ varPropType, varPropValue) dbs.Properties.Append prp Resume Next Else ' 未知的錯誤。 ChangeProperty = False Resume Change_Bye End If End Function Private Sub Command0_Click() On Error GoTo Err_Command0_Click DoCmd.CloseExit_Command0_Click: Exit SubErr_Command0_Click: MsgBox Err.Description Resume Exit_Command0_Click
End Sub Private Sub Command1_Click() ChangeProperty "AllowBypassKey", DB_Boolean, True
If Me!UesrName = "wyn" And Me!Password = "085477" Then
Else MsgBox "密碼錯誤" End If
End Sub Private Sub Command2_Click() ChangeProperty "AllowBypassKey", DB_Boolean, Flase DoCmd.Close End SubPrivate Sub Form_Load() ChangeProperty "AllowBypassKey", DB_Boolean, False End Sub
对不起各位,再追加一个问题,当时忘记加上了: 首先非常感谢西域浪子的热心,但是很遗憾的是我没有用过VB,而是一直在用DELPHI。以下是我从网上找到的关于压缩ASSESS数据库的方法,但是我使用后却不能运行: 我的开发环境是:WIN2000高级服务器版、DELPHI6.0企业版、OFFICE XP: var dao: OLEVariant; begin dao := CreateOleObject('DAO.DBEngine.35'); dao.CompactDatabase('d:\yourDatabaseName.mdb', 'd:\yourNewCompactedDatabaseName.mdb'); end;
不用密碼,用權限,在登錄時存On_load加入
Option Compare Database
Sub SetStartupProperties()
Const DB_Text As Long = 10
Const DB_Boolean As Long = 1
ChangeProperty "StartupForm", DB_Text, "Customers"
ChangeProperty "StartupShowDBWindow", DB_Boolean, False
ChangeProperty "StartupShowStatusBar", DB_Boolean, False
ChangeProperty "AllowBuiltinToolbars", DB_Boolean, False
ChangeProperty "AllowFullMenus", DB_Boolean, True
ChangeProperty "AllowBreakIntoCode", DB_Boolean, False
ChangeProperty "AllowSpecialKeys", DB_Boolean, True
ChangeProperty "AllowBypassKey", DB_Boolean, True
End SubFunction ChangeProperty(strPropName As String, varPropType As Variant, varPropValue As Variant) As Integer
Dim dbs As Object, prp As Variant
Const conPropNotFoundError = 3270 Set dbs = CurrentDb
On Error GoTo Change_Err
dbs.Properties(strPropName) = varPropValue
ChangeProperty = TrueChange_Bye:
Exit FunctionChange_Err:
If Err = conPropNotFoundError Then ' 找不到屬性。
Set prp = dbs.CreateProperty(strPropName, _
varPropType, varPropValue)
dbs.Properties.Append prp
Resume Next
Else
' 未知的錯誤。
ChangeProperty = False
Resume Change_Bye
End If
End Function
Private Sub Command0_Click()
On Error GoTo Err_Command0_Click
DoCmd.CloseExit_Command0_Click:
Exit SubErr_Command0_Click:
MsgBox Err.Description
Resume Exit_Command0_Click
End Sub
Private Sub Command1_Click()
ChangeProperty "AllowBypassKey", DB_Boolean, True
If Me!UesrName = "wyn" And Me!Password = "085477" Then
Else
MsgBox "密碼錯誤"
End If
End Sub
Private Sub Command2_Click()
ChangeProperty "AllowBypassKey", DB_Boolean, Flase
DoCmd.Close
End SubPrivate Sub Form_Load()
ChangeProperty "AllowBypassKey", DB_Boolean, False
End Sub
首先非常感谢西域浪子的热心,但是很遗憾的是我没有用过VB,而是一直在用DELPHI。以下是我从网上找到的关于压缩ASSESS数据库的方法,但是我使用后却不能运行:
我的开发环境是:WIN2000高级服务器版、DELPHI6.0企业版、OFFICE XP:
var
dao: OLEVariant;
begin
dao := CreateOleObject('DAO.DBEngine.35');
dao.CompactDatabase('d:\yourDatabaseName.mdb', 'd:\yourNewCompactedDatabaseName.mdb');
end;