Dim rec As New ADODB.Recordset
set me.子窗体.form.Me.Recordset=rec
是关于子窗体源对像的问题
如下图所示:
file:///f:/sss.bmp
怎么用ADO方来替代 Me.Child26.SourceObject = "窗体2"
我用API的方法,做了一下,但速度太慢了,也不能编辑窗体里的数据
Option Explicit
Private Declare Function LockWindowUpdate Lib "user32" (ByVal hwndLock As Long) As Long
Private Declare Function GetDesktopWindow Lib "user32" () As Long
Private Declare Function SetParent Lib "user32" (ByVal hWndChild As Long, ByVal hWndNewParent As Long) As Long
Private Declare Function ShellExecute Lib "shell32.dll" _
Alias "ShellExecuteA" _
(ByVal hwnd As Long, _
ByVal lpOperation As String, _
ByVal lpFile As String, _
ByVal lpParameters As String, _
ByVal lpDirectory As String, _
ByVal nShowCmd As Long) As Long
Private Const SW_SHOWNORMAL = 1
Private Sub 加载子窗体_Click() Dim mWnd As Long
LockWindowUpdate GetDesktopWindow
DoCmd.OpenForm "窗体2"
mWnd = Forms("窗体2").hwnd
SetParent mWnd, Me.Child26.Form.hwnd
LockWindowUpdate False
DoCmd.SelectObject acForm, "窗体2"
DoCmd.Maximize End Sub