📄 fircj.frm
字号:
VERSION 5.00
Object = "{4F29B06F-16D9-4A0C-9C8A-2F0C02F625FE}#1.0#0"; "FlexCell.ocx"
Begin VB.Form fircj
Caption = "车间"
ClientHeight = 5325
ClientLeft = 60
ClientTop = 450
ClientWidth = 4095
LinkTopic = "Form1"
MDIChild = -1 'True
ScaleHeight = 5325
ScaleWidth = 4095
Begin FlexCell.Grid Grid1
Height = 3585
Left = 60
TabIndex = 7
Top = 540
Width = 4005
_ExtentX = 7064
_ExtentY = 6324
Cols = 5
Rows = 30
End
Begin VB.TextBox txtcode
Height = 285
Left = 3060
TabIndex = 4
Top = 120
Width = 615
End
Begin VB.Frame Frame1
Height = 615
Left = 180
TabIndex = 0
Top = 4620
Width = 3795
Begin VB.CommandButton cmdadd
Caption = "增加"
Height = 255
Left = 120
TabIndex = 3
Top = 240
Width = 795
End
Begin VB.CommandButton cmdsave
Caption = "保存"
Height = 255
Left = 1260
TabIndex = 2
Top = 240
Width = 795
End
Begin VB.CommandButton cmdexit
Caption = "退出"
Height = 255
Left = 2520
TabIndex = 1
Top = 240
Width = 795
End
End
Begin VB.Label Label1
Caption = "车间信息"
BeginProperty Font
Name = "MS Sans Serif"
Size = 13.5
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00FF0000&
Height = 315
Index = 4
Left = 1200
TabIndex = 6
Top = 120
Width = 1575
End
Begin VB.Label Label2
Caption = "注:编号4位,名称最长8位"
Height = 315
Left = 120
TabIndex = 5
Top = 4140
Width = 3675
End
End
Attribute VB_Name = "fircj"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private Sub Form_Load()
Me.Width = 4200
Me.Height = 5800
Grid1.AutoRedraw = False
Grid1.DisplayFocusRect = False
Grid1.Cols = 3
Grid1.Rows = 1
Grid1.FixedRows = 1
Grid1.Column(0).Width = 18
Grid1.Column(1).Width = 100
Grid1.Column(2).Width = 100
dogridfill
Grid1.Column(1).Locked = True
Grid1.AutoRedraw = True
Grid1.Refresh
Set rsTempA = oDb.Execute("select max(cjbh) as maxcode from acj ") 'code号初始
If IsNull(rsTempA!maxcode) Then
txtcode.Text = 1000
Else
txtcode.Text = rsTempA!maxcode + 1
End If
txtcode.Visible = False
End Sub
Private Sub dogridfill()
Grid1.Cell(0, 1).Text = "车间编号"
Grid1.Cell(0, 2).Text = "车间名称"
szSql = "select * from acj order by cjbh"
Set rsTempA = oDb.Execute(szSql)
Do While Not rsTempA.EOF
Grid1.AddItem (rsTempA!cjbh & Chr(9) & rsTempA!cjmc)
rsTempA.MoveNext
Loop
End Sub
Private Sub cmdexit_Click()
Unload Me
End Sub
Private Sub cmdadd_Click()
Grid1.Rows = Grid1.Rows + 1
Grid1.Cell(Grid1.Rows - 1, 1).Text = txtcode.Text
txtcode.Text = Val(txtcode.Text) + 1
End Sub
Private Sub cmdsave_Click()
For i = 1 To Grid1.Rows - 1
griditem = Grid1.Cell(i, 1).Text
Set rsTempA = oDb.Execute("select * from acj where cjbh='" & griditem & "'")
If rsTempA.RecordCount < 1 Then '增加保存
griditem = "'" & Grid1.Cell(i, 1).Text & "'"
If Grid1.Cell(i, 2).Text <> "" Then griditem = griditem & ",'" & Grid1.Cell(i, 2).Text & "'" Else griditem = griditem & ",'N'"
szSql = "insert acj (cjbh,cjmc) values (" & griditem & ")"
oDb.Execute szSql
Else
szSql = "UPDATE acj SET cjmc='" & Grid1.Cell(i, 2).Text & "' where cjbh='" & Grid1.Cell(i, 1).Text & "'"
oDb.Execute szSql
End If
Next i
MsgBox "车间信息成功保存", vbOKOnly, "保存"
cmdsave.Enabled = False
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -