📄 frmcompany.frm
字号:
VERSION 5.00
Begin VB.Form frmCompany
Appearance = 0 'Flat
BackColor = &H00C0E0FF&
BorderStyle = 1 'Fixed Single
Caption = "使用单位设置"
ClientHeight = 5235
ClientLeft = 45
ClientTop = 330
ClientWidth = 5670
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 5235
ScaleWidth = 5670
StartUpPosition = 3 '窗口缺省
Begin VB.TextBox Txtfields
Appearance = 0 'Flat
Height = 1035
Index = 11
Left = 900
TabIndex = 11
Top = 3420
Width = 4575
End
Begin VB.TextBox Txtfields
Appearance = 0 'Flat
Height = 375
Index = 10
Left = 900
TabIndex = 10
Top = 3000
Width = 1815
End
Begin VB.TextBox Txtfields
Appearance = 0 'Flat
Height = 375
Index = 9
Left = 900
TabIndex = 9
Top = 2580
Width = 3315
End
Begin VB.TextBox Txtfields
Appearance = 0 'Flat
Height = 375
Index = 8
Left = 900
TabIndex = 8
Top = 2160
Width = 4575
End
Begin VB.CommandButton cmdExit
Appearance = 0 'Flat
Height = 435
Left = 3000
Picture = "frmCompany.frx":0000
Style = 1 'Graphical
TabIndex = 21
Top = 4620
Width = 960
End
Begin VB.CommandButton cmdSave
Appearance = 0 'Flat
Height = 435
Left = 1620
Picture = "frmCompany.frx":14E4
Style = 1 'Graphical
TabIndex = 12
Top = 4620
Width = 945
End
Begin VB.TextBox Txtfields
Appearance = 0 'Flat
Height = 375
Index = 7
Left = 3660
TabIndex = 7
Top = 1740
Width = 1815
End
Begin VB.TextBox Txtfields
Appearance = 0 'Flat
Height = 375
Index = 6
Left = 3660
TabIndex = 6
Top = 1320
Width = 1815
End
Begin VB.TextBox Txtfields
Appearance = 0 'Flat
Height = 375
Index = 5
Left = 3660
TabIndex = 5
Top = 60
Width = 1815
End
Begin VB.TextBox Txtfields
Appearance = 0 'Flat
Height = 375
Index = 4
Left = 900
TabIndex = 4
Top = 1740
Width = 1695
End
Begin VB.TextBox Txtfields
Appearance = 0 'Flat
Height = 375
Index = 3
Left = 900
TabIndex = 3
Top = 1320
Width = 1695
End
Begin VB.TextBox Txtfields
Appearance = 0 'Flat
Height = 375
Index = 2
Left = 900
TabIndex = 2
Top = 900
Width = 4575
End
Begin VB.TextBox Txtfields
Appearance = 0 'Flat
Height = 375
Index = 1
Left = 900
TabIndex = 1
Top = 480
Width = 4575
End
Begin VB.TextBox Txtfields
Appearance = 0 'Flat
Height = 375
Index = 0
Left = 900
TabIndex = 0
Top = 60
Width = 1695
End
Begin VB.Label Label12
Alignment = 2 'Center
Appearance = 0 'Flat
BackColor = &H00C0E0FF&
Caption = "备注"
ForeColor = &H80000008&
Height = 375
Left = 180
TabIndex = 25
Top = 3780
Width = 555
End
Begin VB.Label Label11
Alignment = 2 'Center
Appearance = 0 'Flat
BackColor = &H00C0E0FF&
Caption = "负责人"
ForeColor = &H80000008&
Height = 255
Left = 60
TabIndex = 24
Top = 3120
Width = 735
End
Begin VB.Label Label10
Appearance = 0 'Flat
BackColor = &H00C0E0FF&
Caption = "电子邮件"
ForeColor = &H80000008&
Height = 255
Left = 120
TabIndex = 23
Top = 2700
Width = 735
End
Begin VB.Label Label9
Alignment = 2 'Center
Appearance = 0 'Flat
BackColor = &H00C0E0FF&
Caption = "网页"
ForeColor = &H80000008&
Height = 255
Left = 60
TabIndex = 22
Top = 2280
Width = 795
End
Begin VB.Label Label8
Alignment = 2 'Center
Appearance = 0 'Flat
BackColor = &H00C0E0FF&
Caption = "税号"
ForeColor = &H80000008&
Height = 255
Left = 2700
TabIndex = 20
Top = 1800
Width = 915
End
Begin VB.Label Label7
Alignment = 2 'Center
Appearance = 0 'Flat
BackColor = &H00C0E0FF&
Caption = "银行帐号"
ForeColor = &H80000008&
Height = 255
Left = 2760
TabIndex = 19
Top = 1380
Width = 795
End
Begin VB.Label Label6
Alignment = 2 'Center
Appearance = 0 'Flat
BackColor = &H00C0E0FF&
Caption = "开户银行"
ForeColor = &H80000008&
Height = 255
Left = 2820
TabIndex = 18
Top = 120
Width = 855
End
Begin VB.Label Label5
Alignment = 2 'Center
Appearance = 0 'Flat
BackColor = &H00C0E0FF&
Caption = "邮政编码"
ForeColor = &H80000008&
Height = 255
Left = 0
TabIndex = 17
Top = 1800
Width = 855
End
Begin VB.Label Label4
Alignment = 2 'Center
Appearance = 0 'Flat
BackColor = &H00C0E0FF&
Caption = "电话"
ForeColor = &H80000008&
Height = 255
Left = 60
TabIndex = 16
Top = 1380
Width = 795
End
Begin VB.Label Label3
Alignment = 2 'Center
Appearance = 0 'Flat
BackColor = &H00C0E0FF&
Caption = "地址"
ForeColor = &H80000008&
Height = 255
Left = 120
TabIndex = 15
Top = 960
Width = 735
End
Begin VB.Label Label2
Alignment = 2 'Center
Appearance = 0 'Flat
BackColor = &H00C0E0FF&
Caption = "名称"
ForeColor = &H80000008&
Height = 255
Left = 60
TabIndex = 14
Top = 540
Width = 795
End
Begin VB.Label Label1
Alignment = 2 'Center
Appearance = 0 'Flat
BackColor = &H00C0E0FF&
Caption = "单位代码"
ForeColor = &H80000008&
Height = 255
Left = 60
TabIndex = 13
Top = 120
Width = 795
End
End
Attribute VB_Name = "frmCompany"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Public strPrimaryKey As String
Public blnAddNew As Boolean
Private Sub cmdExit_Click()
Unload Me
End Sub
Private Sub CmdSave_Click()
Dim sqlstring As String
Dim rstmp As New ADODB.Recordset
On Error GoTo SaveErr
If blnAddNew Then
If Trim(Txtfields(0).Text) = "" Or Trim(Txtfields(1).Text) = "" Then
MsgBox "编码、名称不能为空!", vbInformation
Exit Sub
End If
If CheckExist Then
MsgBox "此使用单位编码已存在,请修改。", vbInformation + vbOKOnly
Call setselect(Txtfields(0))
Exit Sub
End If
sqlstring = "Insert into Company (ChrCompanyNo,ChrCompanyName,chrAddress,ChrTel,ChrPost,ChrBank,ChrBankNo,ChrTaxNo,ChrReticulation,ChrMail,Chrprincipal,ChrRemark) values ('" & Txtfields(0).Text & "','" & Txtfields(1).Text & _
"','" & Txtfields(2).Text & "','" & Txtfields(3).Text & "','" & Txtfields(4).Text & "','" & _
Txtfields(5).Text & "','" & Txtfields(6).Text & "','" & Txtfields(7).Text & "','" & Txtfields(8).Text & "','" & Txtfields(9).Text & "','" & Txtfields(10).Text & "','" & Txtfields(11).Text & "')"
cN.BeginTrans
cN.Execute (sqlstring)
cN.CommitTrans
Unload Me
Call frmFields.cmdRefresh_Click
Else
If Trim(Txtfields(0).Text) = "" Or Trim(Txtfields(1).Text) = "" Then
MsgBox "编码、名称不能为空!", vbInformation
Exit Sub
End If
sqlstring = "Update Company set ChrCompanyName='" & Txtfields(1).Text & "'," & _
" chrAddress='" & Txtfields(2).Text & "',ChrTel='" & Txtfields(3).Text & _
"',ChrPost='" & Txtfields(4).Text & "',ChrBank='" & Txtfields(5).Text & _
"',ChrBankNo='" & Txtfields(6).Text & "',ChrTaxNo='" & Txtfields(7).Text & _
"',ChrReticulation='" & Txtfields(8).Text & "',ChrMail='" & Txtfields(9).Text & _
"',Chrprincipal='" & Txtfields(10).Text & "',ChrRemark='" & Txtfields(11).Text & "' where ChrCompanyNo='" & Trim(Txtfields(0).Text) & "'"
cN.BeginTrans
cN.Execute (sqlstring)
cN.CommitTrans
Unload Me
Call frmFields.cmdRefresh_Click
End If
Exit Sub
SaveErr:
cN.RollbackTrans
MsgBox "保存记录失败:" & err.Description, vbInformation
End Sub
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
Call autoreturn(KeyCode)
End Sub
Private Function CheckExist() As Boolean
Dim sqlstring As String
Dim rstmp As New ADODB.Recordset
On Error GoTo err
sqlstring = "select * from Company where ChrCompanyNo='" & Trim(Txtfields(0).Text) & "'"
rstmp.Open sqlstring, cN, adOpenKeyset, adLockReadOnly
If rstmp.EOF Then
CheckExist = False
Else
CheckExist = True
End If
Exit Function
err:
MsgBox "打开记录失败:" & err.Description, vbInformation
End Function
Private Sub txtFields_KeyDown(Index As Integer, KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyReturn Then
SendKeys "{TAB}"
Exit Sub
End If
End Sub
Private Sub txtFields_KeyPress(Index As Integer, KeyAscii As Integer)
Select Case Index
Case 0
KeyAscii = ValiText(KeyAscii, vbExpInteger, "", Txtfields(Index).Text, 4)
Case 3
KeyAscii = ValiText(KeyAscii, vbExpInteger, "-", Txtfields(Index).Text)
Case 6
KeyAscii = ValiText(KeyAscii, vbExpInteger, "", Txtfields(Index).Text)
End Select
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -