📄 frmqx.frm
字号:
VERSION 5.00
Begin VB.Form FrmQx
Caption = "权限设置"
ClientHeight = 4560
ClientLeft = 60
ClientTop = 450
ClientWidth = 6675
Icon = "FrmQx.frx":0000
LinkTopic = "Form1"
ScaleHeight = 4560
ScaleWidth = 6675
StartUpPosition = 2 '屏幕中心
Begin VB.CommandButton CmdExit
Caption = "退出(&X)"
Height = 375
Left = 4920
TabIndex = 2
Top = 3900
Width = 1035
End
Begin VB.CommandButton CmdOK
Caption = "保存(&O)"
Height = 375
Left = 3180
TabIndex = 1
Top = 3900
Width = 1035
End
Begin VB.Frame Frame1
Caption = "设置权限"
ForeColor = &H00FF0000&
Height = 3315
Left = 240
TabIndex = 0
Top = 240
Width = 6315
Begin VB.ComboBox CmbQx
Height = 300
Left = 4680
Style = 2 'Dropdown List
TabIndex = 14
Top = 1020
Width = 1095
End
Begin VB.ComboBox CmbYk
Height = 300
Left = 4680
Style = 2 'Dropdown List
TabIndex = 12
Top = 2760
Width = 1095
End
Begin VB.ComboBox CmbDy
Height = 300
Left = 4680
Style = 2 'Dropdown List
TabIndex = 10
Top = 2205
Width = 1095
End
Begin VB.ComboBox CmbJd
Height = 300
Left = 4680
Style = 2 'Dropdown List
TabIndex = 8
Top = 1650
Width = 1095
End
Begin VB.ComboBox CmbYh
Height = 300
Left = 4680
Style = 2 'Dropdown List
TabIndex = 6
Top = 480
Width = 1095
End
Begin VB.ComboBox CmbYhm
Height = 300
Left = 1560
Style = 2 'Dropdown List
TabIndex = 3
Top = 540
Width = 1335
End
Begin VB.Label Label6
Caption = "权限设置权限"
Height = 195
Left = 3420
TabIndex = 13
Top = 1080
Width = 1215
End
Begin VB.Label Label5
Caption = "游客管理权限"
Height = 195
Left = 3420
TabIndex = 11
Top = 2820
Width = 1215
End
Begin VB.Label Label4
Caption = "导游管理权限"
Height = 195
Left = 3420
TabIndex = 9
Top = 2265
Width = 1215
End
Begin VB.Label Label3
Caption = "景点管理权限"
Height = 195
Left = 3420
TabIndex = 7
Top = 1695
Width = 1215
End
Begin VB.Label Label2
Caption = "新增用户权限"
Height = 195
Left = 3420
TabIndex = 5
Top = 540
Width = 1215
End
Begin VB.Label Label1
Caption = "清选择用户名"
Height = 195
Left = 300
TabIndex = 4
Top = 600
Width = 1275
End
End
End
Attribute VB_Name = "FrmQx"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private strSQL As String
Private bsfbcsj As Boolean
Private cnntemp As New ADODB.Connection
Private rstTemp As New ADODB.Recordset
Private rstlr As New ADODB.Recordset
Private Sub CmbYhm_Change()
bsfbcsj = True
End Sub
Private Sub CmdExit_Click()
Unload Me
End Sub
Private Sub CmdOK_Click()
Dim Ans As String
If Trim(CmbYhm.Text) = "" Then
MsgBox "请选择用户名", vbInformation, Me.Caption
CmbYhm.SetFocus
Exit Sub
End If
If bsfbcsj Then
Ans = MsgBox("保存以上信息吗?", vbYesNo + vbQuestion, Me.Caption)
If Ans = vbYes Then
' On Error GoTo RollbackOrder
cnntemp.BeginTrans
strSQL = "delete from db_qx where Username='" & Trim(CmbYhm.Text) & "'"
cnntemp.Execute strSQL
strSQL = "select * from db_qx where Username='" & Trim(CmbYhm.Text) & "'"
With rstlr
If .State = adStateOpen Then .Close
.CursorLocation = adUseClient
.Open strSQL, cnntemp, adOpenKeyset, adLockPessimistic, Options:=adCmdText
.AddNew
.Fields("UserName") = CmbYhm.Text
.Fields("AddUser") = CmbYh.Text
.Fields("qx") = CmbQx.Text
.Fields("Jdgl") = CmbJd.Text
.Fields("Dygl") = CmbDy.Text
.Fields("Ykgl") = CmbYk.Text
.Update
End With
cnntemp.CommitTrans
MsgBox "权限设置成功!", vbInformation, Me.Caption
bsfbcsj = False
rstlr.Close
ElseIf Ans = vbNo Then
Exit Sub
End If
End If
Exit Sub
RollbackOrder:
If Err.Number <> 0 Then
MsgBox Err.Description & vbCrLf & "未录入!请检查各项目是否填写正确", vbExclamation, Me.Caption
Exit Sub
End If
cnntemp.RollbackTrans
bsfbcsj = True
On Error GoTo 0
End Sub
Private Sub Form_Load()
Me.Show
SetWindowPos Me.hwnd, HWND_TOPMOST, Me.Left / Screen.TwipsPerPixelX _
, Me.Top \ Screen.TwipsPerPixelY, Me.Width \ Screen.TwipsPerPixelX, _
Me.Height \ Screen.TwipsPerPixelY, 0
DoEvents
CmbYhm.SetFocus
With CmbYh
.AddItem "无"
.AddItem "有"
.ListIndex = 1
End With
With CmbQx
.AddItem "无"
.AddItem "有"
.ListIndex = 1
End With
With CmbJd
.AddItem "无"
.AddItem "有"
.ListIndex = 1
End With
With CmbDy
.AddItem "无"
.AddItem "有"
.ListIndex = 1
End With
With CmbYk
.AddItem "无"
.AddItem "有"
.ListIndex = 1
End With
Call ShowYhm
On Error GoTo Err
' Dim strConnect As String
'
' strConnect = ServerIp
'
' Set cnntemp = Nothing
' With cnntemp
' .Open strConnect
' End With
Set cnntemp = Nothing
With cnntemp
.Provider = "Microsoft.jet.OLEDB.4.0"
.Open App.Path & "\travel.mdb", "admin"
End With
bsfbcsj = True
Exit Sub
Err:
If Err.Number <> 0 Then
MsgBox Err.Description & vbCrLf & "请检查操作是否正确", vbExclamation, Me.Caption
Exit Sub
End If
On Error GoTo 0
End Sub
Private Sub ShowYhm()
strSQL = "select UserName from DB_user"
Call DirectRecordset(strSQL, rstTemp)
If rstTemp.RecordCount <> 0 Then
With CmbYhm
rstTemp.MoveFirst
Do While Not rstTemp.EOF
.AddItem rstTemp("UserName")
rstTemp.MoveNext
Loop
rstTemp.Close
.ListIndex = -1
End With
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -