📄 form1.frm
字号:
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 4440
TabIndex = 11
Top = 4560
Width = 855
End
Begin VB.Label Label3
BackColor = &H00FFFFFF&
Caption = "使用单位"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 2040
TabIndex = 9
Top = 4560
Width = 855
End
Begin VB.Label Label1
Alignment = 2 'Center
BackColor = &H00FFFFFF&
BackStyle = 0 'Transparent
Caption = "山 东 科 技 大 学"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 4200
TabIndex = 7
Top = 120
Width = 5295
End
Begin VB.Line Line1
BorderWidth = 2
X1 = 4560
X2 = 9120
Y1 = 480
Y2 = 480
End
Begin VB.Label Label2
Alignment = 2 'Center
BackStyle = 0 'Transparent
Caption = "物 品 验 收 单"
BeginProperty Font
Name = "宋体"
Size = 14.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 5040
TabIndex = 6
Top = 480
Width = 3375
End
Begin VB.Line Line3
X1 = 4800
X2 = 8640
Y1 = 840
Y2 = 840
End
Begin VB.Label Label7
BackStyle = 0 'Transparent
Caption = "年 月 日"
Height = 255
Left = 2280
TabIndex = 5
Top = 600
Width = 1815
End
Begin VB.Label Label8
BackStyle = 0 'Transparent
Caption = "( )第 号"
Height = 255
Left = 9720
TabIndex = 4
Top = 720
Width = 2055
End
End
Begin MSAdodcLib.Adodc Adodc4
Height = 495
Left = 1200
Top = 5280
Visible = 0 'False
Width = 2655
_ExtentX = 4683
_ExtentY = 873
ConnectMode = 0
CursorLocation = 3
IsolationLevel = -1
ConnectionTimeout= 15
CommandTimeout = 30
CursorType = 3
LockType = 3
CommandType = 2
CursorOptions = 0
CacheSize = 50
MaxRecords = 0
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 = "Adodc2"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
_Version = 393216
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim tem_biaodan_add As String '在原有表单中增加记录时记下的表单号
Public Function shuzi(wenbenkuang As TextBox, KeyAscii As Integer)
If KeyAscii = Asc(".") Or KeyAscii = Asc("1") Or KeyAscii = Asc("2") Or KeyAscii = Asc("3") Or KeyAscii = Asc("4") Or KeyAscii = Asc("5") Or KeyAscii = Asc("6") Or KeyAscii = Asc("7") Or KeyAscii = Asc("8") Or KeyAscii = Asc("9") Or KeyAscii = Asc("0") Or KeyAscii = 8 Then
Else
KeyAscii = 0
End If
If Mid(wenbenkuang.Text, 1, 1) = "0" And Mid(wenbenkuang.Text, 2, 1) <> "." Then
wenbenkuang.Text = ""
MsgBox "填写数字有误!"
End If
If Mid(wenbenkuang.Text, 1, 1) = "." Then
wenbenkuang.Text = ""
End If
Dim i, t As Integer
t = 0 't为标志量判断小数点的个数
If Len(wenbenkuang.Text) >= 2 Then
For i = 1 To Len(wenbenkuang.Text) - 1
If Mid(wenbenkuang.Text, i, 1) = "." Then
t = t + 1
End If
Next i
If t >= 2 Then
wenbenkuang.Text = ""
MsgBox "填写数字有误!"
End If
End If
End Function
Public Function xiaoshudian(shu As Single)
Dim s As String
If shu - Int(shu) = 0 Then
For i = 1 To 2
s = s + "0"
Next i
s = CStr(Int(shu)) + "." + s
shu = Val(s)
End If
End Function
Private Sub Check1_Click()
If Check1.Value = 1 Then
Text14.Enabled = True
Command6.Enabled = True
End If
If Check1.Value = 0 Then
Text14.Enabled = 0
Command6.Enabled = False
End If
End Sub
Private Sub Combo1_Change()
If newdan_flag = True Then '//如果开新单才能使标示新单有效
Adodc2.ConnectionString = " Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & curpath + "wupin.mdb;Persist Security Info=False"
Adodc2.CommandType = adCmdText
Adodc2.RecordSource = "select max(mid(单据号,5,4)) as jine from wupin where mid(单据号,1,4)='" & Combo1.Text & "'"
Adodc2.Refresh
If Not IsNull(Adodc2.Recordset("jine").Value) Then
s = CStr(Val(Adodc2.Recordset("jine").Value) + 1)
For i = 0 To 3 - Len(s)
t = t + "0"
Next i
s = t + s
Label8.Caption = "(" + Combo1.Text + ")" + "第" + s + "号"
str_biaodan = Combo1.Text + s
Else
Label8.Caption = "(" + Combo1.Text + ")" + "第" + "0001" + "号"
str_biaodan = Combo1.Text + "0001"
End If
End If
End Sub
Private Sub Combo1_Click()
If newdan_flag = True Then '//如果开新单才能使标示新单有效
Adodc2.ConnectionString = " Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & curpath + "wupin.mdb;Persist Security Info=False"
Adodc2.CommandType = adCmdText
Adodc2.RecordSource = "select max(mid(单据号,5,4)) as jine from wupin where mid(单据号,1,4)='" & Combo1.Text & "'"
Adodc2.Refresh
If Not IsNull(Adodc2.Recordset("jine").Value) Then
s = CStr(Val(Adodc2.Recordset("jine").Value) + 1)
For i = 0 To 3 - Len(s)
t = t + "0"
Next i
s = t + s
Label8.Caption = "(" + Combo1.Text + ")" + "第" + s + "号"
str_biaodan = Combo1.Text + s
Else
Label8.Caption = "(" + Combo1.Text + ")" + "第" + "0001" + "号"
str_biaodan = Combo1.Text + "0001"
End If
End If
End Sub
Private Sub Command1_Click()
If Adodc1.Recordset.RecordCount >= 5 Then
MsgBox "每张验收单至多开5条记录,请开新单!"
Exit Sub
End If
Adodc1.Recordset.Requery
Adodc2.ConnectionString = " Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & curpath + "wupin.mdb;Persist Security Info=False"
Adodc2.CommandType = adCmdText
Adodc2.RecordSource = "select max(mid(编号,5,4)) as jine from wupin where mid(单据号,1,4)='" & Combo1.Text & "'"
Adodc2.Refresh
If Not IsNull(Adodc2.Recordset("jine").Value) Then
s = CStr(Val(Adodc2.Recordset("jine").Value) + 1)
For i = 0 To 3 - Len(s)
t = t + "0"
Next i
s = t + s
Text7.Text = Combo1.Text + s
Else
Text7.Text = Combo1.Text + "0001"
End If
Text1.Enabled = True
Text2.Enabled = True
Text3.Enabled = True
Text4.Enabled = True
Text5.Enabled = True
Text6.Enabled = True
Text7.Enabled = True
Text8.Enabled = True
Text9.Enabled = True
Text10.Enabled = True
Text11.Enabled = True
Text12.Enabled = True
Text13.Enabled = True
Command1.Enabled = False
Combo1.Enabled = False '组合框禁用
List1.Enabled = False
Command7.Enabled = True '保存功能开启
Command8.Enabled = True '返回功能开启
Command2.Enabled = False '删除功能屏蔽
Command3.Enabled = False '打印功能屏蔽
Command5.Enabled = False '入库功能屏蔽
DataGrid1.Enabled = False '表格功能屏蔽
If Text1.Text <> "" Then
Text8.SetFocus
Else
Text1.SetFocus
End If
End Sub
Private Sub Command2_Click()
On Error GoTo err:
If Adodc1.Recordset.EOF And Adodc1.Recordset.BOF Then
Exit Sub
End If
ffff = MsgBox("确实要删除吗?", vbYesNo)
If ffff = vbYes Then
Adodc1.Recordset.Delete
End If
Adodc1.Recordset.Requery
Adodc2.ConnectionString = " Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & curpath + "wupin.mdb;Persist Security Info=False"
Adodc2.CommandType = adCmdText
Adodc2.RecordSource = "select sum(金额) as jine from wupin where 单据号=" & "'" & str_biaodan & "'"
Adodc2.Refresh
If Not IsNull(Adodc2.Recordset.Fields("jine").Value) Then
Label6.Caption = "¥:" + CStr(Adodc2.Recordset.Fields("jine").Value)
Else
Label6.Caption = "¥:" + "0.00"
End If
'*********************************************
'左边验收单显示刷新
Adodc3.ConnectionString = " Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & curpath + "wupin.mdb;Persist Security Info=False"
Adodc3.CommandType = adCmdText
Adodc3.RecordSource = "select distinct(单据号) as 验收单 from wupin order by 单据号 desc"
Adodc3.Refresh
Adodc3.Recordset.Requery
If Adodc3.Recordset.EOF And Adodc3.Recordset.BOF Then
Else
List1.Clear '先将list 控件内容清空
Adodc3.Recordset.MoveFirst
Do Until Adodc3.Recordset.EOF
List1.AddItem Adodc3.Recordset.Fields("验收单").Value
Adodc3.Recordset.MoveNext
Loop
End If
Exit Sub
err:
End Sub
Private Sub Command3_Click()
Dim PageDirection As Integer
PageDirection = 1
Call SetOrientation(DMDUP_SIMPLEX, PageDirection)
If Adodc1.Recordset.RecordCount < 1 Then
Exit Sub
End If
'********************************************************
Dim ado As ADODB.Connection
Set ado = New ADODB.Connection
Dim rs As ADODB.Recordset
Set rs = New ADODB.Recordset
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -