📄 frmaddnewcustom.frm
字号:
VERSION 5.00
Begin VB.Form frmaddnewcustom
BorderStyle = 3 'Fixed Dialog
Caption = "添加新客户"
ClientHeight = 3165
ClientLeft = 45
ClientTop = 330
ClientWidth = 4530
LinkTopic = "Form1"
MaxButton = 0 'False
MDIChild = -1 'True
MinButton = 0 'False
ScaleHeight = 3165
ScaleWidth = 4530
ShowInTaskbar = 0 'False
Begin VB.TextBox Text4
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 1200
TabIndex = 4
Top = 1920
Width = 3135
End
Begin VB.TextBox Text3
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 1200
TabIndex = 3
Top = 1320
Width = 3135
End
Begin VB.TextBox Text2
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 1200
TabIndex = 2
Top = 720
Width = 3135
End
Begin VB.CommandButton cmdreset
Cancel = -1 'True
Caption = "清空重填"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 2400
TabIndex = 6
Top = 2520
Width = 1695
End
Begin VB.CommandButton Cmdok
Caption = "添加入库"
Default = -1 'True
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 360
TabIndex = 5
Top = 2520
Width = 1575
End
Begin VB.TextBox text1
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 1200
TabIndex = 1
Top = 120
Width = 3135
End
Begin VB.Label Label4
Caption = "联系电话:"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 120
TabIndex = 9
Top = 1920
Width = 1215
End
Begin VB.Label Label3
Caption = "联系人:"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 120
TabIndex = 8
Top = 1320
Width = 975
End
Begin VB.Label Label2
Caption = "客户地址:"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 120
TabIndex = 7
Top = 720
Width = 1335
End
Begin VB.Label Label1
Caption = "客户名称:"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 120
TabIndex = 0
Top = 120
Width = 1335
End
End
Attribute VB_Name = "frmaddnewcustom"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim rs_addkh As New ADODB.Recordset
Dim rs_addcuname As New ADODB.Recordset
Private Sub cmdOK_Click()
If Text1.Text = "" Then
MsgBox "请填写客户名称!", vbOKOnly + vbInformation, "注意"
Text1.SetFocus
Exit Sub
ElseIf Text2.Text = "" Then
MsgBox "请填写客户地址!", vbOKOnly + vbInformation, "注意"
Text2.SetFocus
Exit Sub
ElseIf Text3.Text = "" Then
MsgBox "请填写联系人!", vbOKOnly + vbInformation, "注意"
Text3.SetFocus
Exit Sub
ElseIf Text4.Text = "" Then
MsgBox "请填写联系电话!", vbOKOnly + vbInformation, "注意"
Text4.SetFocus
Exit Sub
End If
Dim sqlkh As String
sqlkh = "select * from customer"
rs_addkh.Open sqlkh, conn, adOpenKeyset, adLockPessimistic
rs_addkh.AddNew
rs_addkh.Fields(0) = Text1.Text
rs_addkh.Fields(1) = Text2.Text
rs_addkh.Fields(2) = Text3.Text
rs_addkh.Fields(3) = Text4.Text
rs_addkh.Update
Dim sqlcun As String
sqlcun = "select * from customername"
rs_addcuname.Open sqlcun, conn, adOpenKeyset, adLockPessimistic
rs_addcuname.AddNew
rs_addcuname.Fields(0) = Text1.Text
rs_addcuname.Update
MsgBox "添加客户成功", vbOKOnly + vbExclamation, ""
rs_addkh.Close
rs_addcuname.Close
End Sub
Private Sub cmdReset_Click()
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Text1.SetFocus
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -