|
strSQL = " INSERT INTO USysUsers(FUserName,FPassword,FPrompt,FAnswer)" & _
" SELECT '" & Me.txtUserName & "','" & RC4(Me.txtPassword) & "','" & Me.cboPrompt & "','" & _
RC4(Me.txtAnswer) & "'"
CurrentProject.Connection.Execute strSQL, lngRecordsAffected
If lngRecordsAffected <> 0 Then
'向权限表中添加记录
lngUserId = DLookup("[FUserId]", "USysUsers", "[FUserName]='" & Me.txtUserName & "'")
strSQL = " INSERT INTO USysUserRights(FUserId,FItemId)" & _
" SELECT " & lngUserId & ",FItemId" & _
" FROM USysMenuItems" & _
" WHERE FParent<>0"
CurrentProject.Connection.Execute strSQL, lngRecordsAffected
If lngRecordsAffected <> 0 Then
MsgBox "注册成功!" & vbCr & "您的用户ID为:" & lngUserId, vbInformation
Call cmdCancel_Click
End If
End If
|
|