?? frmpermission1.frm
字號:
VERSION 5.00
Begin VB.Form frmPermission1
Caption = "用戶權(quán)限設置"
ClientHeight = 3615
ClientLeft = 60
ClientTop = 450
ClientWidth = 6090
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 3615
ScaleWidth = 6090
StartUpPosition = 1 '所有者中心
Begin VB.CommandButton cmdOK
Caption = "確認"
BeginProperty Font
Name = "宋體"
Size = 10.5
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 372
Left = 1560
TabIndex = 6
Top = 3000
Width = 972
End
Begin VB.CommandButton cmdCancel
Caption = "取消"
BeginProperty Font
Name = "宋體"
Size = 10.5
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 372
Left = 2760
TabIndex = 5
Top = 3000
Width = 972
End
Begin VB.Frame Frame2
Caption = "權(quán)限設置"
Height = 1575
Left = 120
TabIndex = 1
Top = 1200
Width = 5775
Begin VB.ComboBox Combo1
Height = 315
Index = 0
Left = 1560
Style = 2 'Dropdown List
TabIndex = 12
Top = 240
Width = 1212
End
Begin VB.ComboBox Combo1
Height = 315
Index = 1
Left = 4440
Style = 2 'Dropdown List
TabIndex = 11
Top = 240
Width = 1212
End
Begin VB.ComboBox Combo1
Height = 315
Index = 2
Left = 1560
Style = 2 'Dropdown List
TabIndex = 10
Top = 600
Width = 1212
End
Begin VB.ComboBox Combo1
Height = 315
Index = 3
Left = 4440
Style = 2 'Dropdown List
TabIndex = 9
Top = 600
Width = 1212
End
Begin VB.ComboBox Combo1
Height = 315
Index = 4
Left = 1560
Style = 2 'Dropdown List
TabIndex = 8
Top = 960
Width = 1212
End
Begin VB.ComboBox Combo1
Height = 315
Index = 5
Left = 4440
Style = 2 'Dropdown List
TabIndex = 7
Top = 960
Width = 1212
End
Begin VB.Label Label2
Caption = "用戶權(quán)限管理:"
Height = 255
Index = 5
Left = 120
TabIndex = 18
Top = 240
Width = 1335
End
Begin VB.Label Label2
Caption = "基本信息管理:"
Height = 255
Index = 6
Left = 3000
TabIndex = 17
Top = 240
Width = 1335
End
Begin VB.Label Label2
Caption = "入庫信息管理:"
Height = 255
Index = 7
Left = 120
TabIndex = 16
Top = 600
Width = 1335
End
Begin VB.Label Label2
Caption = "生產(chǎn)信息管理:"
Height = 255
Index = 8
Left = 3000
TabIndex = 15
Top = 600
Width = 1335
End
Begin VB.Label Label2
Caption = "銷售信息管理:"
Height = 255
Index = 2
Left = 120
TabIndex = 14
Top = 960
Width = 1335
End
Begin VB.Label Label2
Caption = "財務信息管理:"
Height = 255
Index = 3
Left = 3000
TabIndex = 13
Top = 960
Width = 1335
End
End
Begin VB.Frame Frame1
Caption = "用戶信息"
Height = 975
Left = 120
TabIndex = 0
Top = 120
Width = 5775
Begin VB.ComboBox Combo2
Height = 315
Left = 1200
TabIndex = 19
Text = "Combo2"
Top = 360
Width = 1455
End
Begin VB.TextBox Text1
BeginProperty Font
Name = "宋體"
Size = 10.5
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 324
Index = 0
Left = 4080
TabIndex = 2
Top = 360
Width = 1572
End
Begin VB.Label Label2
Caption = "用戶姓名"
BeginProperty Font
Name = "宋體"
Size = 10.5
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Index = 0
Left = 3000
TabIndex = 4
Top = 360
Width = 975
End
Begin VB.Label Label1
Caption = "用戶名"
BeginProperty Font
Name = "宋體"
Size = 10.5
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 240
TabIndex = 3
Top = 360
Width = 855
End
End
End
Attribute VB_Name = "frmPermission1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
'是否改動過記錄,ture為改過
Dim mblChange As Boolean
Dim mrc As ADODB.Recordset
Public txtSQL As String
Private Sub cmdCancel_Click()
Unload Me
End Sub
Private Sub cmdOK_Click()
Dim i As Integer
Dim sMeg As String
Dim MsgText As String
Dim recT As ADODB.Recordset
'先刪除已有記錄
txtSQL = "delete from permission where id ='" & Trim(Combo2) & "'"
Set mrc = ExecuteSQL(txtSQL, MsgText)
'再加入新記錄
txtSQL = "select * from permission"
Set recT = ExecuteSQL(txtSQL, MsgText)
If Not recT.EOF Then
For i = 0 To 5
If Combo1(i).ListIndex <> 0 Then
With recT
.AddNew
.Fields(0) = Trim(Combo2)
.Fields(1) = 10 + i
.Fields(2) = Combo1(i).ListIndex - 1
.Fields(3) = 111
.Update
End With
End If
Next i
recT.Close
End If
If gintPmode = 1 Then
MsgBox "添加記錄成功!", vbOKOnly + vbExclamation, "添加記錄"
Unload Me
Unload frmPermission
frmPermission.Show
ElseIf gintPmode = 2 Then
Unload Me
Unload frmPermission
frmPermission.Show
End If
End Sub
Private Sub Combo1_Change(Index As Integer)
End Sub
Private Sub Combo2_Click()
Dim MsgText As String
Dim i As Integer
Dim recT As ADODB.Recordset
Dim sSQL As String
sSQL = "select * from users where id = '" & Trim(Combo2) & "'"
Set recT = ExecuteSQL(sSQL, MsgText)
If Not recT.EOF Then
Text1(0) = recT.Fields(2)
End If
recT.Close
End Sub
Private Sub Form_Load()
Dim MsgText As String
Dim i As Integer
Dim recT As ADODB.Recordset
Dim recTemp As ADODB.Recordset
Dim sSQL As String
For i = 0 To 5
Combo1(i).AddItem "無權(quán)限"
Combo1(i).ItemData(Combo1(i).NewIndex) = 0
Combo1(i).AddItem "讀權(quán)限"
Combo1(i).ItemData(Combo1(i).NewIndex) = 1
Combo1(i).AddItem "讀寫權(quán)限"
Combo1(i).ItemData(Combo1(i).NewIndex) = 2
Combo1(i).ListIndex = 0
Next i
Combo2.Clear
If gintPmode = 1 Then
Me.Caption = Me.Caption & "添加"
Text1(0).Text = ""
sSQL = "select distinct id from users"
Set recT = ExecuteSQL(sSQL, MsgText)
If Not recT.EOF Then
Do While Not recT.EOF
sSQL = "select * from permission where id = '" & recT.Fields(0) & "'"
Set recTemp = ExecuteSQL(sSQL, MsgText)
If recTemp.EOF Then
Combo2.AddItem recT.Fields(0)
Else
recTemp.Close
End If
recT.MoveNext
Loop
recT.Close
End If
ElseIf gintPmode = 2 Then
Set mrc = ExecuteSQL(txtSQL, MsgText)
If Not mrc.EOF Then
Combo2.AddItem mrc.Fields(0)
Combo2.ListIndex = 0
Combo2.Enabled = False
Text1(0) = mrc.Fields(1)
Text1(0).Enabled = False
Do While Not mrc.EOF
Select Case mrc!module
Case 10
If mrc.Fields(3) = 0 Then
Combo1(0).ListIndex = 1
Else
Combo1(0).ListIndex = 2
End If
Case 11
If mrc.Fields(3) = 0 Then
Combo1(1).ListIndex = 1
Else
Combo1(1).ListIndex = 2
End If
Case 12
If mrc.Fields(3) = 0 Then
Combo1(2).ListIndex = 1
Else
Combo1(2).ListIndex = 2
End If
Case 13
If mrc.Fields(3) = 0 Then
Combo1(3).ListIndex = 1
Else
Combo1(3).ListIndex = 2
End If
Case 14
If mrc.Fields(3) = 0 Then
Combo1(4).ListIndex = 1
Else
Combo1(4).ListIndex = 2
End If
Case 15
If mrc.Fields(3) = 0 Then
Combo1(5).ListIndex = 1
Else
Combo1(5).ListIndex = 2
End If
End Select
mrc.MoveNext
Loop
mrc.Close
End If
Me.Caption = Me.Caption & "修改"
End If
mblChange = False
End Sub
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -