【发布时间】:2012-10-24 16:12:08
【问题描述】:
我有一个包含多个子表单的表单。目前我有两个组合框。一个按供应商过滤子表单,另一个选择一个价格水平来确定哪个子表单,即价格水平,是可见的。我的那部分工作正常。但是,现在我还想根据价格水平选择显示一个消息框。
我有另一个包含特殊客户定价的表格。 Is it possible for example, when the combo box price level is selected it checks to see if there are customers at that price level with special pricing and display a message box with the customers who have special pricing.
如果有两个客户:“客户名称”和“客户名称”有特价。
这是我的表关系
这是我当前的价格水平组合框代码
Option Compare Database
Sub ShowSubform()
'Save unsaved changes to currently open subform
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
'Display appropriate subform based on cboPriceLevel chosen
If cboPriceLevel = "J6" Then
J6_All_subform.Visible = True
J7_All_subform.Visible = False
J8_All_subform.Visible = False
ElseIf cboPriceLevel = "J7" Then
J6_All_subform.Visible = False
J7_All_subform.Visible = True
J8_All_subform.Visible = False
Else
J6_All_subform.Visible = False
J7_All_subform.Visible = False
J8_All_subform.Visible = True
End If
End Sub
Private Sub Form_Current()
'Call subroutine to display appropriate subform based on template type
ShowSubform
End Sub
Private Sub cboPriceLevel_AfterUpdate()
'Call subroutine to display appropriate subform based on template type
ShowSubform
End Sub
感谢您的帮助。如果我说得不明白,请告诉我,您需要更好的解释。
【问题讨论】:
-
是的,但您没有提供足够的详细信息来提供具体的答案。如果您希望它在被选中时触发,您需要将代码添加到组合框的 Got Focus 事件中。如果您想提供更多详细信息,则基本上假装您不熟悉您的项目,阅读您所说的内容,看看您是否理解。例如,我如何知道客户是否处于具有特价的价格水平?
-
我在表格和关系上添加了更多细节。
-
我不会将 got focus 事件用于消息框。它确实会让表单中的选项卡变得非常乏味。
-
我在想,在更新 cboPriceLevel 之后,可以在我现有的 if 语句中添加一些东西
-
如果您想提醒某人注意定价,我建议您使用不显示任何 J8 的文本框和一些明亮的字体用于 J7 或 J6 客户 - 特别是如果您将其放置在客户之后名字,因为他们已经在那个区域寻找了