?? main_jbzl_jsr.frm
字號:
Height = 795
Left = 0
TabIndex = 0
Top = 0
Width = 8220
_ExtentX = 14499
_ExtentY = 1402
ButtonWidth = 1138
ButtonHeight = 1349
Appearance = 1
Style = 1
ImageList = "ImageList1"
_Version = 393216
BeginProperty Buttons {66833FE8-8583-11D1-B16A-00C0F0283628}
NumButtons = 12
BeginProperty Button1 {66833FEA-8583-11D1-B16A-00C0F0283628}
Caption = " 增加 "
Key = "add"
ImageIndex = 1
EndProperty
BeginProperty Button2 {66833FEA-8583-11D1-B16A-00C0F0283628}
Caption = "修改"
Key = "modify"
ImageIndex = 2
EndProperty
BeginProperty Button3 {66833FEA-8583-11D1-B16A-00C0F0283628}
Caption = "刪除"
Key = "delete"
ImageIndex = 3
EndProperty
BeginProperty Button4 {66833FEA-8583-11D1-B16A-00C0F0283628}
Caption = "保存"
Key = "save"
ImageIndex = 4
EndProperty
BeginProperty Button5 {66833FEA-8583-11D1-B16A-00C0F0283628}
Caption = "取消"
Key = "cancel"
ImageIndex = 5
EndProperty
BeginProperty Button6 {66833FEA-8583-11D1-B16A-00C0F0283628}
Caption = "查找"
Key = "find"
ImageIndex = 6
EndProperty
BeginProperty Button7 {66833FEA-8583-11D1-B16A-00C0F0283628}
Enabled = 0 'False
EndProperty
BeginProperty Button8 {66833FEA-8583-11D1-B16A-00C0F0283628}
Enabled = 0 'False
EndProperty
BeginProperty Button9 {66833FEA-8583-11D1-B16A-00C0F0283628}
Enabled = 0 'False
EndProperty
BeginProperty Button10 {66833FEA-8583-11D1-B16A-00C0F0283628}
Enabled = 0 'False
EndProperty
BeginProperty Button11 {66833FEA-8583-11D1-B16A-00C0F0283628}
Enabled = 0 'False
Style = 3
EndProperty
BeginProperty Button12 {66833FEA-8583-11D1-B16A-00C0F0283628}
Caption = "關(guān)閉"
Key = "close"
ImageIndex = 7
EndProperty
EndProperty
BorderStyle = 1
End
Begin VB.Frame Frame1
Height = 1440
Left = 15
TabIndex = 1
Top = 765
Width = 8175
Begin VB.TextBox Text1
Height = 330
Index = 4
Left = 1170
Locked = -1 'True
TabIndex = 12
Top = 960
Width = 2175
End
Begin VB.TextBox Text1
Height = 330
Index = 5
Left = 4575
Locked = -1 'True
TabIndex = 11
Top = 960
Width = 3405
End
Begin VB.TextBox Text1
Height = 330
Index = 3
Left = 4575
Locked = -1 'True
TabIndex = 8
Top = 600
Width = 3405
End
Begin VB.TextBox Text1
Height = 330
Index = 2
Left = 1170
Locked = -1 'True
TabIndex = 7
Top = 600
Width = 2175
End
Begin VB.TextBox Text1
Height = 330
Index = 1
Left = 4575
Locked = -1 'True
TabIndex = 4
Top = 240
Width = 3405
End
Begin VB.TextBox Text1
Enabled = 0 'False
Height = 330
Index = 0
Left = 1170
TabIndex = 3
Top = 240
Width = 2175
End
Begin VB.Label Label6
Caption = "身份證號"
Height = 165
Left = 210
TabIndex = 14
Top = 1035
Width = 750
End
Begin VB.Label Label5
Caption = "備注"
Height = 165
Left = 3525
TabIndex = 13
Top = 1035
Width = 465
End
Begin VB.Label Label4
Caption = "聯(lián)系方式"
Height = 165
Left = 210
TabIndex = 10
Top = 675
Width = 795
End
Begin VB.Label Label3
Caption = "聯(lián)系地址"
Height = 165
Left = 3525
TabIndex = 9
Top = 660
Width = 735
End
Begin VB.Label Label2
Caption = "經(jīng)手人姓名"
Height = 165
Left = 3525
TabIndex = 6
Top = 315
Width = 975
End
Begin VB.Label Label1
Caption = "經(jīng)手人編號"
Height = 165
Left = 210
TabIndex = 2
Top = 315
Width = 945
End
End
End
Attribute VB_Name = "main_jbzl_jsr"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim rs1 As New ADODB.Recordset
Public blnAdd As Boolean
Dim mybookmark
Sub view_data()
Dim i As Integer
If Adodc1.Recordset.RecordCount > 0 Then
For i = 0 To Text1.UBound
Text1(i) = DataGrid1.Columns(i).text
Next i
End If
End Sub
Private Sub DataGrid1_RowColChange(LastRow As Variant, ByVal LastCol As Integer)
view_data
End Sub
Private Sub Form_Activate()
If sql <> "" Then
Adodc1.RecordSource = sql
Adodc1.Refresh
If Adodc1.Recordset.RecordCount > 0 Then
view_data
Else
MsgBox "沒有找到符合條件的記錄!", , "提示窗口"
End If
End If
End Sub
Private Sub Form_Load()
Me.Caption = text
tlbState Toolbar1, False
End Sub
Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
sql = ""
End Sub
Private Sub Text1_GotFocus(Index As Integer)
Text1(Index).BackColor = &HFFFF00
Text1(Index).SelStart = 0
Text1(Index).SelLength = Len(Text1(Index))
End Sub
Private Sub Text1_KeyDown(Index As Integer, KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyReturn And Index < 5 Then Text1(Index + 1).SetFocus
End Sub
Private Sub Text1_LostFocus(Index As Integer)
Text1(Index).BackColor = &H80000005
End Sub
Private Sub Toolbar1_ButtonClick(ByVal Button As MSComctlLib.Button)
Select Case Button.Key
Case "add"
blnAdd = True
tlbState Toolbar1, True
rs1.Open "select * from tb_jsr", cnn, adOpenStatic
If rs1.RecordCount > 0 Then
rs1.MoveLast
Text1(0) = Format(Val(rs1.Fields("經(jīng)手人編號")) + 1, "000")
Else
Text1(0) = "001"
End If
rs1.Close
For i = 1 To Text1.UBound
Text1(i) = ""
Text1(i).Locked = False
Next i
Text1(1).SetFocus
Case "modify"
If Adodc1.Recordset.RecordCount > 0 Then
blnAdd = False
tlbState Toolbar1, True
For i = 1 To Text1.UBound
Text1(i).Locked = False
Next i
view_data
mybookmark = DataGrid1.Bookmark
Else
MsgBox "系統(tǒng)沒有要修改的數(shù)據(jù)!", , "提示窗口"
End If
Case "delete"
If Adodc1.Recordset.RecordCount > 0 Then
Adodc1.Recordset.Delete
Adodc1.Refresh
Else
MsgBox "系統(tǒng)沒有要刪除的數(shù)據(jù)!", , "提示窗口"
End If
Case "save"
On Error GoTo SaveErr
If Text1(0).text = "" Then
MsgBox "系統(tǒng)不允許" & Label1 & "為空!", , "提示窗口"
Exit Sub
End If
If blnAdd = True Then
cnn.Execute ("insert into tb_jsr(經(jīng)手人編號,經(jīng)手人姓名,聯(lián)系方式,聯(lián)系地址,身份證號,備注,錄入人,錄入日期) values('" + Text1(0) + _
"','" + Text1(1) + "','" + Text1(2) + "','" + Text1(3) + "','" + Text1(4) + "','" + Text1(5) + "','" + czy + "','" + Str(Date) + "')")
Adodc1.Refresh
tlbState Toolbar1, False
For i = 1 To Text1.UBound
Text1(i).Locked = True
Next i
Else
cnn.Execute ("update tb_jsr set 經(jīng)手人姓名 ='" + Text1(1) + "',聯(lián)系方式 ='" + Text1(2) + _
"',聯(lián)系地址 ='" + Text1(3) + "',身份證號 ='" + Text1(4) + "',備注='" + Text1(5) + _
"',修改人='" + czy + "',修改日期='" + Str(Date) + "'where 經(jīng)手人編號='" + DataGrid1.Columns(0) + "'")
Adodc1.Refresh
DataGrid1.Bookmark = mybookmark
view_data
tlbState Toolbar1, False
For i = 1 To Text1.UBound
Text1(i).Locked = True
Next i
End If
Exit Sub
SaveErr:
MsgBox Err.Description
Case "cancel"
tlbState Toolbar1, False
For i = 1 To Text1.UBound
Text1(i).Locked = True
Next i
Case "find"
tb = "tb_jsr"
Load main_find
main_find.Show 1
Case "close"
Unload Me
End Select
End Sub
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -