📄 frmsalseitemedit.frm
字号:
BOFAction = 0
EOFAction = 0
ConnectStringType= 1
Appearance = 1
BackColor = -2147483643
ForeColor = -2147483640
Orientation = 0
Enabled = -1
Connect = ""
OLEDBString = ""
OLEDBFile = ""
DataSourceName = ""
OtherAttributes = ""
UserName = ""
Password = ""
RecordSource = ""
Caption = "Adodc1"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
_Version = 393216
End
Begin MSDataGridLib.DataGrid DataGrid1
Height = 1215
Left = 120
TabIndex = 1
Top = 960
Width = 7575
_ExtentX = 13361
_ExtentY = 2143
_Version = 393216
HeadLines = 1
RowHeight = 15
FormatLocked = -1 'True
BeginProperty HeadFont {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ColumnCount = 5
BeginProperty Column00
DataField = "Item"
Caption = "货号"
BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED}
Type = 0
Format = ""
HaveTrueFalseNull= 0
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 2052
SubFormatType = 0
EndProperty
EndProperty
BeginProperty Column01
DataField = "Name"
Caption = "名称"
BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED}
Type = 0
Format = ""
HaveTrueFalseNull= 0
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 2052
SubFormatType = 0
EndProperty
EndProperty
BeginProperty Column02
DataField = "Specification"
Caption = "规格"
BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED}
Type = 0
Format = ""
HaveTrueFalseNull= 0
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 2052
SubFormatType = 0
EndProperty
EndProperty
BeginProperty Column03
DataField = "Color"
Caption = "颜色"
BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED}
Type = 0
Format = ""
HaveTrueFalseNull= 0
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 2052
SubFormatType = 0
EndProperty
EndProperty
BeginProperty Column04
DataField = "Unit"
Caption = "单位"
BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED}
Type = 0
Format = ""
HaveTrueFalseNull= 0
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 2052
SubFormatType = 0
EndProperty
EndProperty
SplitCount = 1
BeginProperty Split0
BeginProperty Column00
ColumnWidth = 1409.953
EndProperty
BeginProperty Column01
ColumnWidth = 1440
EndProperty
BeginProperty Column02
ColumnWidth = 1500.095
EndProperty
BeginProperty Column03
ColumnWidth = 1395.213
EndProperty
BeginProperty Column04
EndProperty
EndProperty
End
Begin VB.Label Label1
Caption = "选择的货号是:"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 3720
TabIndex = 3
Top = 480
Width = 1695
End
End
End
Attribute VB_Name = "FrmSalseItemEdit"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Public Modify As Boolean
Public OriSalesItemID As String
Private Sub DataGrid1_Click()
If Adodc1.Recordset.RecordCount <> 0 Then
TxtItem.Text = Adodc1.Recordset.Fields(1)
End If
End Sub
Private Sub DataGrid2_Click()
If Adodc2.Recordset.RecordCount <> 0 Then
TxtCustomer.Text = Adodc2.Recordset.Fields(0)
End If
End Sub
Private Sub DataGrid3_Click()
If Adodc3.Recordset.RecordCount <> 0 Then
TxtSalesman.Text = Adodc3.Recordset.Fields(0)
End If
End Sub
Private Sub Form_Load()
Adodc1.ConnectionString = "driver={SQL Server};server=" + Trim(Server) + ";uid=" + Trim(User) + ";pwd=" + Trim(Password) + ";database=ERP"
Adodc1.RecordSource = "select * from Item where MB<>'B购买' and MB<>'S外发' "
Set DataGrid1.DataSource = Adodc1
Adodc2.ConnectionString = "driver={SQL Server};server=" + Trim(Server) + ";uid=" + Trim(User) + ";pwd=" + Trim(Password) + ";database=ERP"
Adodc2.RecordSource = "select * from Customer "
Set DataGrid2.DataSource = Adodc2
Adodc3.ConnectionString = "driver={SQL Server};server=" + Trim(Server) + ";uid=" + Trim(User) + ";pwd=" + Trim(Password) + ";database=ERP"
Adodc3.RecordSource = "select * from Salesman "
Set DataGrid3.DataSource = Adodc3
End Sub
Private Sub LblCancel_Click()
Unload Me
End Sub
Private Function Check() As Boolean
If Trim(TxtItem) = "" Then
MsgBox "请选择要销售的产品货号"
DataGrid1.SetFocus
Check = False
Exit Function
End If
If Trim(TxtCustomer) = "" Then
MsgBox "请选择产品购货商"
DataGrid2.SetFocus
Check = False
Exit Function
End If
If Trim(TxtSalesman) = "" Then
MsgBox "请选择产品销售员"
DataGrid3.SetFocus
Check = False
Exit Function
End If
If Trim(TxtSalesItemID) = "" Then
MsgBox "请输入销售产品ID"
TxtSalesItemID.SetFocus
Check = False
Exit Function
End If
If Trim(TxtUnitPrice) = "" Then
MsgBox "请输入销售产品单价"
TxtUnitPrice.SetFocus
Check = False
Exit Function
End If
If Trim(TxtCurrency) = "" Then
MsgBox "请输入币种"
TxtCurrency.SetFocus
Check = False
Exit Function
End If
Check = True
End Function
Private Sub LblOK_Click()
'判断要编辑信息是否完整
If Check = False Then
Exit Sub
End If
With MySalseItem
.SalesItemID = TxtSalesItemID.Text
.CustomerID = TxtCustomer.Text
.Item = TxtItem.Text
.Currency1 = TxtCurrency.Text
.UnitPrice = TxtUnitPrice.Text
.SalesmanID = TxtSalesman.Text
'判断操作是添加还是修改
If Modify = False Then '判断为添加操作
'判断销售员ID是否已经存在
If .In_DB(TxtSalesItemID.Text) = True Then
MsgBox "销售产品代号重复,请重新设置"
TxtSalesItemID.SetFocus
TxtSalesItemID.SelStart = 0
TxtSalesItemID.SelLength = Len(TxtSalesItemID)
Exit Sub
Else
.Insert '添加
MsgBox "添加成功"
End If
Else '判断为修改操作
.Update (OriSalesItemID)
MsgBox "修改成功"
End If
End With
Unload Me
End Sub
Private Sub TxtUnitPrice_KeyPress(KeyAscii As Integer)
EnterTAB (KeyAscii)
If In_Single(KeyAscii) = False Then
KeyAscii = 0
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -