📄 selname.frm
字号:
VERSION 5.00
Object = "{5E9E78A0-531B-11CF-91F6-C2863C385E30}#1.0#0"; "MSFLXGRD.OCX"
Begin VB.Form SelName
AutoRedraw = -1 'True
BorderStyle = 1 'Fixed Single
Caption = "姓名选项"
ClientHeight = 3855
ClientLeft = 45
ClientTop = 330
ClientWidth = 7560
Icon = "SelName.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
MDIChild = -1 'True
MinButton = 0 'False
Moveable = 0 'False
ScaleHeight = 3855
ScaleWidth = 7560
Begin VB.CommandButton Command3
Caption = "新增"
Height = 495
Left = 3720
TabIndex = 4
Top = 3240
Width = 1095
End
Begin VB.CommandButton Command2
Caption = "退出"
Height = 495
Left = 6360
TabIndex = 2
Top = 3240
Width = 1095
End
Begin VB.CommandButton Command1
Caption = "确定"
Height = 495
Left = 5040
TabIndex = 1
Top = 3240
Width = 1095
End
Begin VB.Data Data1
Caption = "Data1"
Connect = "Access"
DatabaseName = "D:\jp\vb\生日餐会系统\BSystem.mdb"
DefaultCursorType= 0 '缺省游标
DefaultType = 2 '使用 ODBC
Exclusive = 0 'False
Height = 495
Left = 360
Options = 0
ReadOnly = -1 'True
RecordsetType = 1 'Dynaset
RecordSource = "基本资料"
Top = 3120
Visible = 0 'False
Width = 1575
End
Begin MSFlexGridLib.MSFlexGrid MSFlexGrid1
Bindings = "SelName.frx":030A
Height = 2895
Left = 120
TabIndex = 0
Top = 120
Width = 7335
_ExtentX = 12938
_ExtentY = 5106
_Version = 393216
Cols = 7
FixedCols = 0
AllowBigSelection= 0 'False
HighLight = 2
SelectionMode = 1
AllowUserResizing= 1
End
Begin VB.Label Label1
AutoSize = -1 'True
Height = 180
Left = 240
TabIndex = 3
Top = 3240
Width = 90
End
End
Attribute VB_Name = "SelName"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Public Function GetfgridRecord()
If Data1.Recordset.RecordCount <> 0 Then
Data1.Recordset.MoveFirst
If Data1.Recordset.NoMatch = False Then
Data1.Recordset.Move MSFlexGrid1.Row - 1
ViewForm.GetFlagViewForm (Data1.Recordset.Fields("ID"))
End If
End If
End Function
Private Sub Command1_Click()
GetfgridRecord
ViewForm.Enabled = True
ViewForm.EBaseInfo (True)
ViewForm.EBthdInfo (True)
ModifySelName
Unload Me
End Sub
Private Sub Command2_Click()
ViewForm.Enabled = True
Unload Me
End Sub
Private Sub Command3_Click()
' GetfgridRecord
ViewForm.Enabled = True
ViewForm.EBaseInfo (True)
ViewForm.EBthdInfo (True)
ModifySelName
Unload Me
End Sub
Private Sub Form_Load()
Data1.DatabaseName = App.Path & "\BSystem.mdb"
'''''''''''''
''框架
Me.Height = 4260
Me.Width = 7680
Me.Top = 1500
Me.Left = 2000
MSFlexGrid1.Visible = True
Command3.Visible = True
' Command2.SetFocus
Dim strSel As String
strSel = ViewForm.Text1.Text
strSel = "Select * from 基本资料 where 姓名 like '" & strSel & "*' order by 姓名 asc"
Data1.RecordSource = strSel
Data1.Refresh
If Data1.Recordset.RecordCount = 0 Then
MSFlexGrid1.Visible = False
MSFlexGrid1.Refresh
Command3.Visible = False
' ModifySelNameForm
' MSFlexGrid1.Rows = 2
ViewForm.InitFlagViewForm
Label1.Top = 120
Label1.Left = 600
Label1.Caption = "没有找到对应的记录,按[确定]可以输入新的记录!"
Exit Sub
Else
ModifySelNameForm
MSFlexGrid1.Row = 0
''''''''''''''''''
'显示记录
Dim strTemp As String
Data1.Recordset.MoveFirst
Do While Not Data1.Recordset.EOF
strTemp = ""
strTemp = strTemp & Data1.Recordset!姓名
strTemp = strTemp & vbTab & Data1.Recordset!出生年月
If Data1.Recordset.Fields("性别") = JP_SET_NUM_MALE Then
strTemp = strTemp & vbTab & JP_SET_CH_MALE
Else
strTemp = strTemp & vbTab & JP_SET_CH_FEMALE
End If
strTemp = strTemp & vbTab & Data1.Recordset!地址
strTemp = strTemp & vbTab & Data1.Recordset!电话
strTemp = strTemp & vbTab & Data1.Recordset!父
strTemp = strTemp & vbTab & Data1.Recordset!母
MSFlexGrid1.AddItem strTemp
' MSFlexGrid1.CellForeColor = 3333
Data1.Recordset.MoveNext
Loop
End If
Label1.Top = 3240
Label1.Left = 240
Label1.Caption = "共有" & Data1.Recordset.RecordCount & "条记录"
End Sub
Private Function ModifySelNameForm()
With MSFlexGrid1
.Rows = 1
.Cols = 7
'''''''''''''''''
'显示标志
.ColWidth(0) = 800
.ColWidth(1) = 1000
.ColWidth(2) = 450
.ColWidth(3) = 2350
.ColWidth(4) = 1000
.ColWidth(5) = 1000
.ColWidth(6) = 1000
.TextMatrix(0, 0) = "姓名"
.TextMatrix(0, 1) = "生日"
.TextMatrix(0, 2) = "性别"
.TextMatrix(0, 3) = "地址"
.TextMatrix(0, 4) = "电话"
.TextMatrix(0, 5) = "父亲姓名"
.TextMatrix(0, 6) = "母亲姓名"
End With
End Function
Public Sub ModifySelName()
Dim strSel As String
Dim num As Integer
num = ViewForm.SetFlagViewForm
strSel = "Select * from 基本资料 where ID = " & CStr(num)
ViewForm.Data1.RecordSource = strSel
ViewForm.Data1.Refresh
With ViewForm.Data1.Recordset
If .RecordCount = 0 Then
' MsgBox "没有可以显示的记录!"
ViewForm.InitFlagViewForm
' ViewForm.ClearFrameValue
ViewForm.ModifyBthdInfo
Exit Sub
End If
ViewForm.GetBaseInfo
End With
End Sub
Private Sub MSFlexGrid1_Click()
'GetfgridRecord
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -