|
8#

楼主 |
发表于 2013-1-26 12:49:18
|
只看该作者
===============上附件
Option Compare Database
Private Sub Form_Load()
'锁子窗体
Me.订单明细子窗体.Locked = True
End Sub
Private Sub 保存_Click()
'这个怎么做?
'关键是子记录数可能变动,可能大于原记录数,也可能小于原记录数。
End Sub
Private Sub 查询_Click()
If IsNull(Me.订单号) Then
MsgBox "请输入查询订单号", vbOKOnly
Exit Sub
End If
Dim sql0 As String, sql1 As String
Dim rs0 As New ADODB.Recordset
Dim rs1 As New ADODB.Recordset
sql0 = "select * from 订单 where 订单号='" & Me.订单号 & "'"
sql1 = "select * from 订单明细 where 订单号='" & Me.订单号 & "'"
With rs0
.CursorLocation = adUseClient
.Open sql0, CurrentProject.Connection, adOpenKeyset, adLockOptimistic
.ActiveConnection = Nothing
End With
Me.客户名称 = rs0.Fields("客户名称")
With rs1
.CursorLocation = adUseClient
.Open sql1, CurrentProject.Connection, adOpenKeyset, adLockOptimistic
.ActiveConnection = Nothing
End With
Set Me.订单明细子窗体.Form.Recordset = rs1
Dim ctl As Control
For Each ctl In Me.订单明细子窗体.Controls
If ctl.ControlType = acTextBox Then
ctl.ControlSource = ctl.Name
End If
Next
rs0.Close
rs1.Close
Set rs0 = Nothing
Set rs1 = Nothing
End Sub
Private Sub 修改_Click()
Me.订单明细子窗体.Locked = False
'可修改状态
End Sub |
本帖子中包含更多资源
您需要 登录 才可以下载或查看,没有帐号?注册
x
|