📄 module3.bas
字号:
Attribute VB_Name = "Module3"
Option Explicit
Private rs As New ADODB.Recordset
Private strconn As String
Private strsql As String
Private rs1 As New ADODB.Recordset
Private strsql1 As String
Private rs11 As New ADODB.Recordset
Private strsql11 As String
Private s As String
Public ck1 As String
Public xu11 As Integer
Public ok11 As Integer
Public re1 As Integer
Sub xulang2()
On Error Resume Next
strconn = "provider=microsoft.jet.oledb.4.0;data source=" & App.Path & "\jxc.mdb"
strsql = "select * from guo"
With rs
If .State = adStateOpen Then
.Close
End If
.ActiveConnection = strconn
.Source = strsql
.LockType = adLockOptimistic
.CursorLocation = adUseClient
.CursorType = adOpenDynamic
.Open
End With
rs.AddNew
rs(0) = addguoform1.Text1.Text
rs(1) = addguoform1.Combo1.Text
rs(2) = addguoform1.Text4.Text
rs(3) = addguoform1.Text3.Text
rs(4) = addguoform1.Text5.Text
rs(5) = addguoform1.Combo2.Text
rs(6) = addguoform1.Text6.Text
rs(7) = addguoform1.Text7.Text
rs(8) = addguoform1.Text8.Text
rs.Update
Set rs = Nothing
guoform1.Text1.Text = addguoform1.Text2.Text
guoform1.Combo1.Text = addguoform1.Text1.Text
guoform1.Combo1.Enabled = False
addguoform1.Text1.Enabled = False
addguoform1.Text2.Enabled = False
guoform1.Text2.Text = Format(Now, "yyyy-mm-dd")
If guoform1.Text5.Text = "" Then s = 0
If guoform1.Text5.Text <> "" Then s = guoform1.Text5.Text
guoform1.Text5.Text = s + addguoform1.Text6.Text * addguoform1.Text7.Text
addguoform1.Combo1.Text = ""
addguoform1.Text3.Text = ""
addguoform1.Text5.Text = ""
addguoform1.Text6.Text = ""
addguoform1.Text7.Text = ""
addguoform1.Text8.Text = ""
addguoform1.Combo2.Text = ""
guoform1.Command1.Caption = "增 加"
guoform1.Command2.Enabled = True
guoform1.Command3.Enabled = True
strconn = "provider=microsoft.jet.oledb.4.0;data source=" & App.Path & "\jxc.mdb"
strsql1 = "select 代号 from base where 仓库='" & addguoform1.Text4.Text & "'"
With rs1
If .State = adStateOpen Then
.Close
End If
.ActiveConnection = strconn
.Source = strsql1
.LockType = adLockReadOnly
.CursorLocation = adUseClient
.CursorType = adOpenDynamic
.Open
End With
addguoform1.Combo1.Visible = False
addguoform1.Combo3.Visible = True
If xu11 <> 1 Then
rs1.MoveFirst
Do While Not rs1.EOF
addguoform1.Combo3.AddItem rs1(0)
rs1.MoveNext
Loop
End If
strconn = "provider=microsoft.jet.oledb.4.0;data source=" & App.Path & "\jxc.mdb"
strsql11 = "select 代号,仓库,类别,品名,单位,单价(元),数量,备注 from guo where 凭证号='" & guoform1.Combo1.Text & "'"
With rs11
If .State = adStateOpen Then
.Close
End If
.ActiveConnection = strconn
.Source = strsql11
.LockType = adLockOptimistic
.CursorLocation = adUseClient
.CursorType = adOpenDynamic
.Open
End With
Set guoform1.DataGrid1.DataSource = rs11
Set guoform1.Adodc1.Recordset = rs11
guoform1.Adodc1.Caption = "当前记录为:" & guoform1.Adodc1.Recordset.AbsolutePosition & "/" & guoform1.Adodc1.Recordset.RecordCount
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -