📄 setuserform.frm
字号:
VERSION 5.00
Object = "{5E9E78A0-531B-11CF-91F6-C2863C385E30}#1.0#0"; "MSFLXGRD.OCX"
Begin VB.Form SetUserForm
Caption = "用户游览"
ClientHeight = 3990
ClientLeft = 60
ClientTop = 345
ClientWidth = 6285
LinkTopic = "Form1"
MaxButton = 0 'False
MDIChild = -1 'True
MinButton = 0 'False
ScaleHeight = 3990
ScaleWidth = 6285
Begin VB.CommandButton Command4
Caption = "删 除"
Height = 375
Left = 4200
TabIndex = 6
Top = 2880
Width = 1335
End
Begin VB.CommandButton Command3
Caption = "退 出"
Height = 375
Left = 4200
TabIndex = 7
Top = 3360
Width = 1335
End
Begin VB.CommandButton Command2
Caption = "修 改"
Height = 375
Left = 4200
TabIndex = 5
Top = 2400
Width = 1335
End
Begin VB.CommandButton Command1
Caption = "新 增"
Height = 375
Left = 4200
TabIndex = 4
Top = 1920
Width = 1335
End
Begin VB.ComboBox Combo1
Height = 300
ItemData = "SetUserForm.frx":0000
Left = 4800
List = "SetUserForm.frx":0002
TabIndex = 3
Text = "Combo1"
Top = 1035
Width = 1335
End
Begin VB.TextBox Text2
Height = 270
IMEMode = 3 'DISABLE
Left = 4800
PasswordChar = "*"
TabIndex = 2
Text = "Text2"
Top = 680
Width = 1335
End
Begin VB.TextBox Text1
Height = 270
Left = 4800
TabIndex = 1
Text = "Text1"
Top = 320
Width = 1335
End
Begin MSFlexGridLib.MSFlexGrid MSFlexGrid1
Bindings = "SetUserForm.frx":0004
Height = 3735
Left = 120
TabIndex = 0
TabStop = 0 'False
Top = 120
Width = 3615
_ExtentX = 6376
_ExtentY = 6588
_Version = 393216
Cols = 3
FixedCols = 0
Redraw = -1 'True
AllowBigSelection= 0 'False
FocusRect = 0
HighLight = 2
ScrollBars = 1
SelectionMode = 1
AllowUserResizing= 1
End
Begin VB.Data Data1
Caption = "Data1"
Connect = "Access"
DatabaseName = "E:\jp\vb\生日餐会系统\BSystem.mdb"
DefaultCursorType= 0 '缺省游标
DefaultType = 2 '使用 ODBC
Exclusive = 0 'False
Height = 495
Left = 3000
Options = 0
ReadOnly = 0 'False
RecordsetType = 1 'Dynaset
RecordSource = "用户"
Top = 2640
Visible = 0 'False
Width = 1500
End
Begin VB.Data Data2
Caption = "Data2"
Connect = "Access"
DatabaseName = "E:\jp\vb\生日餐会系统\BSystem.mdb"
DefaultCursorType= 0 '缺省游标
DefaultType = 2 '使用 ODBC
Exclusive = 0 'False
Height = 345
Left = 5160
Options = 0
ReadOnly = 0 'False
RecordsetType = 1 'Dynaset
RecordSource = "用户"
Top = 2040
Visible = 0 'False
Width = 1140
End
Begin VB.Label Label4
Caption = "Label4"
Height = 495
Left = 3720
TabIndex = 11
Top = 1320
Visible = 0 'False
Width = 2535
End
Begin VB.Label Label3
AutoSize = -1 'True
Caption = "权限"
Height = 180
Left = 4080
TabIndex = 10
Top = 1080
Width = 360
End
Begin VB.Label Label2
AutoSize = -1 'True
Caption = "密码"
Height = 180
Left = 4080
TabIndex = 9
Top = 720
Width = 360
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "用户名"
Height = 180
Left = 4080
TabIndex = 8
Top = 360
Width = 540
End
End
Attribute VB_Name = "SetUserForm"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim nSelUserId As Integer '选择的用户ID号
Private Const JP_USERDATA_CREATED = 1 '建立
Private Const JP_USERDATA_CHANGE = 2 '修改
Dim nOldRow As Integer '旧的行号
Private Sub Command1_Click()
If SaveUserData(JP_USERDATA_CREATED) = False Then
Exit Sub
End If
GetUserDataViewForm
nSelUserId = -1
SetUserDataTextBoxClear (True)
End Sub
Private Sub Command2_Click()
If nSelUserId = -1 Then
MsgBox "没有选择记录,请选择。"
Exit Sub
End If
If SaveUserData(JP_USERDATA_CHANGE) = False Then
Exit Sub
End If
GetUserDataViewForm
nSelUserId = -1
SetUserDataTextBoxClear (True)
End Sub
Private Sub Command3_Click()
Data1.Recordset.Close
Data2.Recordset.Close
Unload Me
End Sub
Private Sub Command4_Click()
If nSelUserId = -1 Then
MsgBox "没有选择记录,请选择。"
Exit Sub
Exit Sub
End If
If MsgBox("是否确定删除?", vbYesNo) = vbYes Then
' Dim strSQL As String
' strSQL = "SELECT * FROM 用户 order by 用户等级, 用户名;"
' Data1.RecordSource = strSQL
Data1.Refresh
Data1.Recordset.Move nSelUserId
Data1.Recordset.Delete
' Data1.Recordset.Update
End If
GetUserDataViewForm
nSelUserId = -1
SetUserDataTextBoxClear (True)
End Sub
Private Sub Form_Load()
Data1.DatabaseName = App.Path & "\BSystem.mdb"
Data2.DatabaseName = App.Path & "\BSystem.mdb"
ModifyUserDataViewForm
SetUserDataTextBoxClear (True)
GetUserDataViewForm
nOldRow = -1
End Sub
''''''''''''
''得到用户数据
Private Sub GetUserDataViewForm()
Dim strSQL As String
Dim strTemp As String
strSQL = "SELECT * FROM 用户 where 用户等级 <='" & tyUserStru.sUserLev & "' order by 用户等级, 用户名;"
Data1.RecordSource = strSQL
Data1.Refresh
With Data1.Recordset
If .RecordCount = 0 Then
.Close
Command2.Enabled = False
Command3.Enabled = False
MsgBox "没有数据"
Exit Sub
Else
Command2.Enabled = True
Command3.Enabled = True
End If
'msflexgrid结构
'{
MSFlexGrid1.Clear
MSFlexGrid1.Cols = 3
MSFlexGrid1.Rows = 1
MSFlexGrid1.Row = 0
MSFlexGrid1.Col = 0
'显示标志
MSFlexGrid1.ColWidth(0) = 1200
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -