www.pudn.com > jxc001.rar > FrmSetSup.frm
VERSION 5.00
Object = "{CDE57A40-8B86-11D0-B3C6-00A0C90AEA82}#1.0#0"; "MSDATGRD.OCX"
Begin VB.Form FrmSetSup
Caption = "供应商设置"
ClientHeight = 5895
ClientLeft = 60
ClientTop = 345
ClientWidth = 5205
Icon = "FrmSetSup.frx":0000
LinkTopic = "Form1"
MDIChild = -1 'True
ScaleHeight = 5895
ScaleWidth = 5205
Begin VB.Frame Frame2
Height = 2595
Left = 0
TabIndex = 8
Top = 3300
Width = 5180
Begin VB.TextBox txtsupplier_name
DataField = "supplier_name"
DataMember = "ComSupplier"
DataSource = "DEjxc"
Enabled = 0 'False
Height = 285
Left = 1395
TabIndex = 14
Top = 935
Width = 3375
End
Begin VB.TextBox txtsupplier_id
DataField = "supplier_id"
DataMember = "ComSupplier"
DataSource = "DEjxc"
Enabled = 0 'False
Height = 285
Left = 1395
TabIndex = 12
Top = 555
Width = 1320
End
Begin VB.CommandButton CmdAct
Caption = "恢复(&U)"
Enabled = 0 'False
Height = 315
Index = 1
Left = 2880
TabIndex = 10
Top = 1680
Width = 1275
End
Begin VB.CommandButton CmdAct
Caption = "保存(&S)"
Enabled = 0 'False
Height = 315
Index = 0
Left = 960
TabIndex = 9
Top = 1680
Width = 1275
End
Begin VB.Label lblFieldLabel
Alignment = 1 'Right Justify
AutoSize = -1 'True
Caption = "供应商名称:"
Height = 180
Index = 1
Left = 375
TabIndex = 13
Top = 975
Width = 990
End
Begin VB.Label lblFieldLabel
Alignment = 1 'Right Justify
AutoSize = -1 'True
Caption = "供应商编号:"
Height = 180
Index = 0
Left = 375
TabIndex = 11
Top = 600
Width = 990
End
End
Begin VB.Frame Frame1
Height = 3375
Left = 0
TabIndex = 0
Top = -60
Width = 5175
Begin VB.CommandButton CmdDep
Caption = "退出(&X)"
Height = 315
Index = 5
Left = 3780
TabIndex = 7
Top = 2940
Width = 1275
End
Begin VB.CommandButton CmdDep
Caption = "列表(&P)"
Height = 315
Index = 4
Left = 3780
TabIndex = 6
Top = 2388
Width = 1275
End
Begin VB.CommandButton CmdDep
Caption = "删除(&D)"
Height = 315
Index = 3
Left = 3780
TabIndex = 5
Top = 1836
Width = 1275
End
Begin VB.CommandButton CmdDep
Caption = "查询(&F)"
Height = 315
Index = 2
Left = 3780
TabIndex = 4
Top = 1284
Width = 1275
End
Begin VB.CommandButton CmdDep
Caption = "编辑(&E)"
Height = 315
Index = 1
Left = 3780
TabIndex = 3
Top = 732
Width = 1275
End
Begin VB.CommandButton CmdDep
Caption = "增加(&N)"
Height = 315
Index = 0
Left = 3780
TabIndex = 2
Top = 180
Width = 1275
End
Begin MSDataGridLib.DataGrid DataGrid1
Bindings = "FrmSetSup.frx":0442
Height = 3075
Left = 60
TabIndex = 1
Top = 180
Width = 3615
_ExtentX = 6376
_ExtentY = 5424
_Version = 393216
AllowUpdate = 0 'False
AllowArrows = -1 'True
HeadLines = 1
RowHeight = 15
TabAcrossSplits = -1 'True
TabAction = 2
WrapCellPointer = -1 'True
FormatLocked = -1 'True
BeginProperty HeadFont {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
DataMember = "ComSupplier"
ColumnCount = 2
BeginProperty Column00
DataField = "supplier_id"
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 = "supplier_name"
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
ColumnAllowSizing= 0 'False
ColumnWidth = 1184.882
EndProperty
BeginProperty Column01
ColumnAllowSizing= 0 'False
ColumnWidth = 2085.166
EndProperty
EndProperty
End
End
End
Attribute VB_Name = "FrmSetSup"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private rsSupplier As ADODB.Recordset
Private strMaxNum As String
Private blnIsSQL As Boolean
Private Sub CmdAct_Click(Index As Integer)
With rsSupplier
Select Case Index
Case 0
.UpdateBatch
.MoveLast
Case 1
.CancelUpdate
If .RecordCount <> 0 Then
.MoveFirst
End If
End Select
End With
Call IsEdit(False)
Me.DataGrid1.Refresh
End Sub
Private Sub CmdDep_Click(Index As Integer)
Dim intAnswer As Integer
Select Case Index
Case 0
Call SupAddNew
Case 1
Call IsEdit(True)
Me.txtsupplier_name.SetFocus
Case 2
FrmSql.intNumField = 2
FrmSql.Show vbModal
Select Case FrmSql.intNumField
Case -1
blnIsSQL = False
CmdDep(0).Enabled = True
CmdDep(3).Enabled = True
rsSupplier.Filter = Me.DataGrid1.Columns.Item(0).DataField & _
"<>''"
Case -2
Case Else
blnIsSQL = True
CmdDep(0).Enabled = False
CmdDep(3).Enabled = False
rsSupplier.Filter = Me.DataGrid1.Columns.Item(FrmSql.intNumField).DataField & _
" like '*" & FrmSql.strSqlField & "*'"
End Select
Case 3
intAnswer = MsgBox("确认删除当前记录吗?", vbYesNo + vbQuestion, "删除确认")
If intAnswer = vbYes Then
With rsSupplier
.Delete
.UpdateBatch
If .RecordCount <> 0 Then
.MoveFirst
Else
For intAnswer = 1 To 4
CmdDep(intAnswer).Enabled = False
Next
End If
End With
End If
Case 4
Case 5
Unload Me
End Select
End Sub
Private Sub Form_Load()
intNumWindows = OpenWindow(intNumWindows)
Me.Height = 6300
Me.Width = 5325
Call SetFormStu(Me, frmMain)
Set rsSupplier = DEjxc.rsComSupplier
Call IsEdit(False)
End Sub
Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
If CmdDep(5).Enabled = False Then
MsgBox "请先退出编辑状态后再退出该程序!", , "提示"
Cancel = True
End If
End Sub
Private Sub Form_Unload(Cancel As Integer)
intNumWindows = Closewindow(intNumWindows)
rsSupplier.Filter = Me.DataGrid1.Columns.Item(0).DataField & "<>''"
rsSupplier.Close
Set rsSupplier = Nothing
End Sub
Private Sub SupAddNew()
Dim strSQL As String
With rsSupplier
If .RecordCount = 0 Then
strMaxNum = 0
Else
.MoveLast
strMaxNum = !supplier_id
End If
.AddNew "supplier_id", Format(CLng(strMaxNum) + 1, "0#######")
Call IsEdit(True)
Me.txtsupplier_name.SetFocus
End With
End Sub
Private Sub IsEdit(blnIsEdit As Boolean)
Dim intNum As Integer
Me.txtsupplier_name.Enabled = blnIsEdit
For intNum = 0 To 1
Me.CmdAct(intNum).Enabled = blnIsEdit
Next
For intNum = 0 To 5
Me.CmdDep(intNum).Enabled = Not blnIsEdit
Next
If blnIsSQL = True Then
CmdDep(0).Enabled = False
CmdDep(3).Enabled = False
End If
If rsSupplier.RecordCount = 0 Then
For intNum = 1 To 4
Me.CmdDep(intNum).Enabled = False
Next
End If
End Sub