访问VBA子窗体未过滤的其他子窗体当在导航窗体Embbedded [英] Access VBA SubForm Not Filtering Other Subform When Embbedded in Navigation Form

查看:443
本文介绍了访问VBA子窗体未过滤的其他子窗体当在导航窗体Embbedded的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两个子窗体嵌入导航形式的未绑定的形式,像这样的:

在左侧的窗体,我有以下的code与onfocus事件的客户名称字段,该过滤器上显示从右侧选定的客户详细信息的权利子窗体:

 私人小组CustomerName_GotFocus()

形式frmCustomers_sjh [客户地址表] .Form.Filter =客户名称='&放大器;! Me.CustomerName和放大器; '
窗体!frmCustomers_sjh![客户地址表] .Form.FilterOn = TRUE

结束小组
 

这伟大工程时,我有frmCustomers_sjh开放本身,但它掷骰子时,我从导航的形式运行。我得到运行时错误'2450'Access无法找到引用的形式frmCustomers_sjh`。

我已经做了足够的研究知道,在运行导航表单中的code是不同的,有点棘手一起玩,但我一直没能解决这里的问题。

注意事项:

  1. 在不使用导航窗体不是一个选项(客户要求)
  2. 拆分表格是不是一种选择,要么,因为我需要的只是用户名搜索目录在右边,与左边的详细信息表单。
  3. 我愿意接受任何其他的设计方案,作为我的导航形式的理解是低,因为我刚开始摆弄它。
解决方案

我解决了这个!

我拿出VBA code和放置一个文本框控件源左侧的未绑定的形式设置为客户名称字段中子窗体。然后,我创建了子窗体上的文本框和客户名称字段的形式!

之间的正确的亲子关系

呜呼!

链接帮了不少忙!

I have an unbound form with two subforms embedded into a navigation form, like this:

On the subform on the left side, I have the following code related to the OnFocus Event of the CustomerName field, which filters the subform on the right to show the customer detail that is selected from the right:

Private Sub CustomerName_GotFocus()

Forms!frmCustomers_sjh![Customer Address Form].Form.Filter = "CustomerName = '" & Me.CustomerName & "'"
Forms!frmCustomers_sjh![Customer Address Form].Form.FilterOn = True

End Sub

This works great when I have the frmCustomers_sjh open by itself, but it craps out when I run it from the Navigation form. I get Run-Time Error '2450' that Access can't find the referenced form 'frmCustomers_sjh`.

I've done enough research to know that running the code within the navigation form is different and a bit trickier to play with, but I haven't been able to solve the issue here.

Things to note:

  1. Not using the Navigation Form is not an option (client requirements)
  2. Splits Form are not an option either, as I need a search directory on only customer name on the right, with a detail form on left.
  3. I am open to any other design solutions, as my understanding of Navigation Forms is low since I just started playing with it.

解决方案

I solved this!

I took out the VBA code and placed a text box with the control source set to the CustomerName field in the subform on the left in the unbound form. Then I created the parent-child relationship for the subform on the right between that text box and the CustomerName field in that form!

Woohoo!

This link helped a lot!

这篇关于访问VBA子窗体未过滤的其他子窗体当在导航窗体Embbedded的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆