Private Sub Form_Open(Cancel As Integer)
abc (发货单)
End Sub
发货单是一个窗体对象.各位朋友帮我看一下.
Public Function abc(frm As Form)
Dim ctlsub As Control
frm.RecordsetType = 2
For Each ctlsub In frm.Controls
If ctlsub.ControlType = SubForm Then
ctlsub.Form.RecordsetType = 2
End If
Next ctlsub
谢谢goodidea朋友,如下是调试成功的.
Public Function abc(frm As String)
Dim ctlsub As Control
Forms(frm).RecordsetType = 2
For Each ctlsub In Forms(frm).Controls
If ctlsub.ControlType = acSubform Then
ctlsub.Form.RecordsetType = 2
End If
Next ctlsub