📄 frm_ygxx.frm
字号:
Left = 0
TabIndex = 0
Top = 0
Width = 9915
_ExtentX = 17489
_ExtentY = 1429
ButtonWidth = 1138
ButtonHeight = 1376
Appearance = 1
Style = 1
ImageList = "ImageList1"
DisabledImageList= "ImageList1"
HotImageList = "ImageList1"
_Version = 393216
BeginProperty Buttons {66833FE8-8583-11D1-B16A-00C0F0283628}
NumButtons = 8
BeginProperty Button1 {66833FEA-8583-11D1-B16A-00C0F0283628}
Caption = " 增加 "
ImageIndex = 1
EndProperty
BeginProperty Button2 {66833FEA-8583-11D1-B16A-00C0F0283628}
Caption = " 编辑 "
ImageIndex = 2
EndProperty
BeginProperty Button3 {66833FEA-8583-11D1-B16A-00C0F0283628}
Caption = "删除"
ImageIndex = 3
EndProperty
BeginProperty Button4 {66833FEA-8583-11D1-B16A-00C0F0283628}
Caption = "保存"
ImageIndex = 4
EndProperty
BeginProperty Button5 {66833FEA-8583-11D1-B16A-00C0F0283628}
Caption = "取消"
ImageIndex = 5
EndProperty
BeginProperty Button6 {66833FEA-8583-11D1-B16A-00C0F0283628}
Caption = "查询"
ImageIndex = 6
EndProperty
BeginProperty Button7 {66833FEA-8583-11D1-B16A-00C0F0283628}
Caption = "打印"
ImageIndex = 7
EndProperty
BeginProperty Button8 {66833FEA-8583-11D1-B16A-00C0F0283628}
Caption = "关闭"
ImageIndex = 8
EndProperty
EndProperty
BorderStyle = 1
End
Begin MSAdodcLib.Adodc Adodc1
Height = 375
Left = 2640
Top = 6120
Visible = 0 'False
Width = 5895
_ExtentX = 10398
_ExtentY = 661
ConnectMode = 0
CursorLocation = 3
IsolationLevel = -1
ConnectionTimeout= 15
CommandTimeout = 30
CursorType = 3
LockType = 3
CommandType = 1
CursorOptions = 0
CacheSize = 50
MaxRecords = 0
BOFAction = 0
EOFAction = 0
ConnectStringType= 1
Appearance = 1
BackColor = -2147483643
ForeColor = -2147483640
Orientation = 0
Enabled = -1
Connect = "Provider=MSDASQL.1;Persist Security Info=False;User ID=sa;Data Source=ljm"
OLEDBString = "Provider=MSDASQL.1;Persist Security Info=False;User ID=sa;Data Source=ljm"
OLEDBFile = ""
DataSourceName = ""
OtherAttributes = ""
UserName = ""
Password = ""
RecordSource = "select * from Table_YGXX"
Caption = "Adodc1"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
_Version = 393216
End
End
Attribute VB_Name = "frm_YGXX"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim i
Public adoCon As New ADODB.Connection
Public adoRs As New ADODB.Recordset
Private Sub Combo1_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then
Text8.SetFocus
Else
End If
End Sub
Private Sub Command1_Click()
frm_zw1.Height = 3180
frm_zw1.Width = 4095
frm_zw1.Show
frm_zw1.Left = 6400
frm_zw1.Top = 1600
End Sub
Private Sub Form_Load()
Text7.Locked = False
Text7.Enabled = True
End Sub
Private Sub Form_Unload(Cancel As Integer)
Unload Me
MDI_main.Toolbar1.Visible = True
End Sub
Private Sub Text2_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then
Text3.SetFocus
Else
End If
End Sub
Private Sub Text3_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then
Text4.SetFocus
Else
End If
End Sub
Private Sub Text4_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then
frm_zw1.Height = 3180
frm_zw1.Width = 4095
frm_zw1.Show
frm_zw1.DataGrid1.SetFocus
frm_zw1.Left = 6400
frm_zw1.Top = 1600
Else
End If
End Sub
Private Sub Text5_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then
Text6.SetFocus
Else
End If
End Sub
Private Sub Text6_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then
Combo1.SetFocus
Else
End If
End Sub
Private Sub Text7_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then
If Text7.Text <> "" Then
If Asc(Text7.Text) < 48 Or Asc(Text7.Text) > 57 Then
MsgBox "员工编号应该为数字编号的形式!!", 48, "房地产销售管理系统"
Text7.Text = ""
Text7.SetFocus
Else
If Toolbar1.Buttons(2).Enabled = True Or Toolbar1.Buttons(3).Enabled = True Then
Adodc1.RecordSource = "select * from Table_YGXX where 员工编号='" + Text7.Text + "'"
Adodc1.Refresh
If Adodc1.Recordset.RecordCount > 0 Then
Toolbar1.Buttons(3).Enabled = True
Text7.Text = Adodc1.Recordset.Fields("员工编号")
Text2.Text = Adodc1.Recordset.Fields("员工姓名")
Text3.Text = Adodc1.Recordset.Fields("身份证")
Text4.Text = Adodc1.Recordset.Fields("职务")
Text5.Text = Adodc1.Recordset.Fields("联系电话")
Text6.Text = Adodc1.Recordset.Fields("手机")
Combo1.Text = Adodc1.Recordset.Fields("工作状况")
Text8.Text = Adodc1.Recordset.Fields("备注")
Else
MsgBox "数据库中没有该员工的信息,请您确认后重新输入", 32, "房地产销售管理系统"
Text7.SetFocus
End If
Else
Text2.SetFocus
End If
End If
' Text2.SetFocus
Else
MsgBox "输入的员工编号不能为空!!", 32, "房地产销售管理系统"
Text7.SetFocus
End If
Else
End If
End Sub
Private Sub Toolbar1_ButtonClick(ByVal Button As MSComctlLib.Button)
Set adoCon = New ADODB.Connection
adoCon.Open "Provider=MSDASQL.1;Persist Security Info=False;User ID=sa;Data Source=ljm"
Select Case Button.Index
Case 1
Text7.Enabled = False
Adodc1.RecordSource = "select * from Table_YGXX"
Adodc1.Refresh
If Adodc1.Recordset.RecordCount > 0 Then
Adodc1.Recordset.MoveLast
Text7.Text = Adodc1.Recordset.Fields("员工编号")
Text7.Text = Val(Text7.Text) + 1
Else
Text7.Text = 20041000
End If
'增加员工信息
Text7.Locked = False
Text2.Locked = False
Text3.Locked = False
Text4.Locked = False
Text5.Locked = False
Text6.Locked = False
Combo1.Locked = False
Text8.Locked = False
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Text5.Text = ""
Text6.Text = ""
Combo1.Text = ""
Text8.Text = ""
Toolbar1.Buttons(1).Enabled = True
Toolbar1.Buttons(2).Enabled = False
Toolbar1.Buttons(3).Enabled = False
Toolbar1.Buttons(4).Enabled = True
Toolbar1.Buttons(5).Enabled = True
Toolbar1.Buttons(6).Enabled = False
Toolbar1.Buttons(7).Enabled = False
Toolbar1.Buttons(8).Enabled = True
Text2.SetFocus
Case 2 '编辑员工信息
Text7.Enabled = True
Text7.SetFocus
Toolbar1.Buttons(1).Enabled = False
Toolbar1.Buttons(2).Enabled = True
Toolbar1.Buttons(3).Enabled = False
Toolbar1.Buttons(4).Enabled = True
Toolbar1.Buttons(5).Enabled = True
Toolbar1.Buttons(6).Enabled = False
Toolbar1.Buttons(7).Enabled = False
Toolbar1.Buttons(8).Enabled = True
Text7.Locked = False
Text2.Locked = False
Text3.Locked = False
Text4.Locked = False
Text5.Locked = False
Text6.Locked = False
Combo1.Locked = False
Text8.Locked = False
Case 3 '删除员工信息
If Text7.Text <> "" Then
i = MsgBox("您确认要删除该员工的信息吗?", 17, "房地产销售管理系统")
Adodc1.RecordSource = "select * from Table_YGXX where 员工编号='" + Text7.Text + "'"
'Adodc1.Refresh
If Adodc1.Recordset.RecordCount > 0 Then
If i = vbOK Then
Adodc1.Recordset.Delete
Else
End If
Else
MsgBox "当前数据库中已经没有记录可删除", 32, "房地产销售管理系统"
End If
Adodc1.RecordSource = "select * from Table_YGXX"
Adodc1.Refresh
Else
MsgBox "删除的员工信息不能为空", 32, "房地产销售管理系统"
'Text7.SetFocus
End If
Case 4 '保存员工信息
Toolbar1.Buttons(4).Enabled = False
If Text7.Text <> "" Then
If Toolbar1.Buttons(1).Enabled = True Then
Set adoRs = adoCon.Execute("insert into Table_YGXX values(" & Text7 & ",'" & Text2 & "','" & Text3 & "','" & Text4 & "','" & Text5 & "','" & Text6 & "','" & Combo1 & "','" & Text8 & "')")
MsgBox "数据保存成功!!", 32, "房地产销售管理系统"
Adodc1.Refresh
Else
Adodc1.RecordSource = "select * from Table_YGXX where 员工编号='" + Text7.Text + "'"
Adodc1.Refresh
If Adodc1.Recordset.RecordCount > 0 Then
Adodc1.Recordset.Delete
Set adoRs = adoCon.Execute("insert into Table_YGXX values(" & Text7 & ",'" & Text2 & "','" & Text3 & "','" & Text4 & "','" & Text5 & "','" & Text6 & "','" & Combo1 & "','" & Text8 & "')")
MsgBox "数据保存成功!!", 32, "房地产销售管理系统"
Adodc1.Refresh
Else
Set adoRs = adoCon.Execute("insert into Table_YGXX values(" & Text7 & "','" & Text2 & "','" & Text3 & "','" & Text4 & "','" & Text5 & "','" & Text6 & "','" & Combo1 & "','" & Text8 & "')")
MsgBox "数据保存成功!!", 32, "房地产销售管理系统"
Adodc1.Refresh
End If
End If
Else
Adodc1.RecordSource = "select * from Table_YGXX"
Adodc1.Refresh
End If
Case 5 '取消员工信息
frm_YGXX.Toolbar1.Buttons(1).Enabled = True
frm_YGXX.Toolbar1.Buttons(2).Enabled = True
frm_YGXX.Toolbar1.Buttons(3).Enabled = True
frm_YGXX.Toolbar1.Buttons(4).Enabled = False
frm_YGXX.Toolbar1.Buttons(5).Enabled = False
frm_YGXX.Toolbar1.Buttons(6).Enabled = True
frm_YGXX.Toolbar1.Buttons(7).Enabled = True
frm_YGXX.Toolbar1.Buttons(8).Enabled = True
Text7.Locked = True
Text2.Locked = True
Text3.Locked = True
Text4.Locked = True
Text5.Locked = True
Text6.Locked = True
Combo1.Locked = True
Text8.Locked = True
If Text7.Text <> "" Then
Text2.SetFocus
Adodc1.RecordSource = "select * from Table_YGXX order by 员工编号 "
Adodc1.Refresh
If Adodc1.Recordset.RecordCount > 0 Then
Text7.Text = Adodc1.Recordset.Fields("员工编号")
Text2.Text = Adodc1.Recordset.Fields("员工姓名")
Text3.Text = Adodc1.Recordset.Fields("身份证")
Text4.Text = Adodc1.Recordset.Fields("职务")
Text5.Text = Adodc1.Recordset.Fields("联系电话")
Text6.Text = Adodc1.Recordset.Fields("手机")
Combo1.Text = Adodc1.Recordset.Fields("工作状况")
Text8.Text = Adodc1.Recordset.Fields("备注")
Else
End If
Else
End If
Case 6 '查询员工信息
frm_YGXX.Hide
frm_ygcx.Show
frm_ygcx.Height = 7155
frm_ygcx.Width = 11040
frm_ygcx.Left = 400
frm_ygcx.Top = 230
Case 7 '打印员工信息
DataEnvironment1.rsCommand1.Open "select * from Table_YGXX"
If DataEnvironment1.rsCommand1.RecordCount > 0 Then
Data_YGXX.Show
Else
MsgBox "此设备编号不存在,请确认后重新输入"
DataEnvironment1.rsCommand1.Close
End If
Case 8 '返回系统主界面
adoCon.Close
Unload Me
MDI_main.Toolbar1.Visible = True
End Select
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -