|
有3个窗体:frm账单表, 内有子窗体frm账单表child, 还有一个是 frmB(某个未绑定窗体)
当frm账单表child单独打开时,字段“账单号码” 的DblClick事件是可以成功打开“frmB”的;
可是当frm账单表child作为子窗体打开时(“frm账单表”打开时),字段“账单号码” 的 DblClick 事件 系统报错:
frmB Form_Load:
找不到宏表达式 或 Visal Basic 代码中引用的窗体 “frm账单表child”。
以下是代码:
frm账单表child 里字段“账单号码”的双击事件:
Private Sub 账单号码_DblClick(Cancel As Integer)
DoCmd.OpenForm "frmB", acNormal
End Sub
-------------------------------------------------------------------------------------------------------------------------------------------------
frmB的加载代码:
Private Sub Form_Load()
Dim Stemp As String
Dim rs As ADODB.Recordset
Set rs = New ADODB.Recordset
Me.Form.Refresh
Stemp = "SELECT [tbl账单].* FROM [tbl账单] WHERE 账单号码 LIKE '" & Forms!frm账单表child![账单号码] & "'"
rs.Open Stemp, CurrentProject.Connection, adOpenKeyset, adLockOptimistic
With rs
Me.账单号码 = Nz(![账单号码].Value, "")
Me.日期 = Nz(![日期].Value, Null)
Me.客户名称 = Nz(![客户名称].Value, "")
......
End With
rs.Close
DoCmd.SetWarnings False
DoCmd.RunSQL "insert into [tbl账单明细temp] select [tbl账单明细].* FROM [tbl账单明细] WHERE 账单号码 LIKE '" & Me.账单号码 & "'"
DoCmd.SetWarnings True
End Sub
--------------------------------------------------------------------------------------------------------
请问为什么会找不到frm账单表child呢?这个问题要怎么解决呢?谢谢!!
|
|