Microsoft访问 - 报告上的标志行项目如果清单未完成
我在这个网站上一直是读者多年,但是今天是我必须问自己的问题的第一天。抱歉,如果我的格式更好。
我正在为客户端应用程序创建一个跟踪系统,并且需要创建一个小通知,以指示最终用户分析师是否缺少有关应用程序上给定联系人的任何清单项目。
我的当前设置涉及一张包含联系信息的表(recordID,parendId,firstName,lastname,email,电话),带有分析师清单(recordid,parentId,parentid,suroment,solutionemail,phonenumpresent,aderseisisisential)的表格,并包含一个子report,该表格该表格该表格查询客户的正确联系人名称。
子报告是记录ID的列表,该列表已从最终用户中隐藏,但存在以使弹出清单函数和联系人名称。理想情况下,如果分析师清单中缺少任何项目,则将在报告中的联系人名称旁边弹出小警告图标,并留在那里直到清单完成。我可以在表格的其他部分,用于不同的清单,但不能在报告内部进行这项工作。
无论我尝试哪种方法,脚本都会更改每个行项目上图标的可见性,而不仅仅是所讨论的行项目。我已经尝试了以下方法,并将类似的代码放入详细信息_Format(我需要时不会触发事件),并将标志存储为是/否布尔值,在报告查询的同一张表上(报告确实确实如此)不要自动更新,并且当它更新时,我会遇到同一问题)。
Private Sub ContactFirstLastName_Click()
'Open Checklist for a given contact
CurrentContact = Me.ID
CurrentContactName = Me.ContactFirstLastName.Value
DoCmd.OpenForm "ContactsChecklistForm", , , , , acDialog
Dim rs As DAO.Recordset
SetRecord rs, "DocGatheringContacts", , Me.ID, "ID"
Dim UniqueEmail As Boolean
Dim PhoneNumPresent As Boolean
Dim DOBPresent As Boolean
Dim AddressResidential As Boolean
UniqueEmail = rs.Fields("UniqueEmail")
PhoneNumPresent = rs.Fields("PhoneNumPresent")
DOBPresent = rs.Fields("DOBPresent")
AddressResidential = rs.Fields("AddressResidential")
If UniqueEmail And PhoneNumPresent And DOBPresent And AddressResidential Then
Me.ContactWarning.Visible = False
Else
Me.ContactWarning.Visible = True
End If
End Sub
我的混乱源于以下事实:在上面的代码中,iid和me。我要单击的“ ContactWarning”,而不仅仅是线实例。据我从微软的文档“我”中了解的是,应该一直涉及整个报告,但是直到我才能使用。
关于为什么可能会发生的任何想法,还是我可以采取另一种方法来实现预期的效果?
I've been a reader on this site for years but today is the first day I have to ask my own question. Apologies if my formatting could be better.
I'm creating a tracking system for client applications and need to create a small notification indicating if the end user analyst is missing any checklist items regarding a given contact on the application.
My current set up involves a table with the contact information (RecordID, ParentID, FirstName, LastName, Email, Phone), a table with the analyst checklist (RecordID, ParentID, UniqueEmail, PhoneNumPresent, AddressIsResidential) and a form that contains a subreport that queries the correct contact names for the client.
The subreport is a list of record ID's, which are hidden from the end user but present to make the pop up checklist function, and the contact names. Ideally if any item is missing from the analyst checklist a small caution icon will pop up next to the contact name in the report and stay there until the checklist is completed. I can make this work in other parts of the form, for different checklists, but not inside of a report.
No matter which approach I try, the script changes the visibility of the icon on EVERY line item instead of just the line item in question. I have tried the approach below, as well as putting similar code into Detail_Format (Event doesn't trigger when I need it to), and storing the flag as a Yes/No Boolean on the same table that the report queries (the report does not update automatically and when it does update I run into the same issue).
Private Sub ContactFirstLastName_Click()
'Open Checklist for a given contact
CurrentContact = Me.ID
CurrentContactName = Me.ContactFirstLastName.Value
DoCmd.OpenForm "ContactsChecklistForm", , , , , acDialog
Dim rs As DAO.Recordset
SetRecord rs, "DocGatheringContacts", , Me.ID, "ID"
Dim UniqueEmail As Boolean
Dim PhoneNumPresent As Boolean
Dim DOBPresent As Boolean
Dim AddressResidential As Boolean
UniqueEmail = rs.Fields("UniqueEmail")
PhoneNumPresent = rs.Fields("PhoneNumPresent")
DOBPresent = rs.Fields("DOBPresent")
AddressResidential = rs.Fields("AddressResidential")
If UniqueEmail And PhoneNumPresent And DOBPresent And AddressResidential Then
Me.ContactWarning.Visible = False
Else
Me.ContactWarning.Visible = True
End If
End Sub
My confusion stems from the fact that in the above code Me.ID and Me.ContactFirstLastName.Value both accurately reflect the name that I click on, but after the analyst checklist ("ContactsChecklistForm") is closed Me.ContactWarning seems to affect all instances of "ContactWarning" instead of only the line instance I am clicking. From what I understand from Microsoft's documentation "Me" should be referring to the entire report the entire time, but it doesn't appear to be until Me.ContactWarning is used.
Any thoughts on why that may be happening or another approach I can take to achieve the desired effect?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我最终对这个问题采取了不同的方法。最初,我正在求助于ContactFistLastName_Click事件的一部分,以便在查看清单时会触发它,但是我发现它更有效地运行我的标记脚本作为清单OKE_CLICK事件的一部分,因此仅触发它,因此它仅触发它清单更新时。
借鉴了上面的6月7日的建议,我从图像控件切换到链接到报告查询的表字段的文本框控件,而不是使用条件格式来更改颜色或触发VBA函数,而是只需将字段的值设置为“”或Unicode字符u+26a0,这是一个与我希望使用的图像非常相似的警告符号。
每当更新清单时,以下脚本都会运行,并导致显示警告图标或不适当显示:
非常感谢June7让我指向正确的方向!
I ended up taking a different approach to the problem. Initially I was attmepting to run my flagging script as part of the ContactFistLastName_click event so that it would trigger whenever the checklist was viewed, however I have found it more effective to run my flagging script as part of the checklist okay_click event so that it only triggers when the checklist is updated.
Drawing on the advice from June7 above, I switched from an image control to a textbox control that is linked to a field on the table that the report queries, and instead of using conditional formatting to either change the color or trigger a VBA function, I simply set the value of the field to either "" or the unicode character U+26A0 which is a warning symbol very similar to the image I was hoping to use.
The following script runs whenever the checklist is updated and causes a warning icon to be displayed or not to display as appropriate:
Many thanks to June7 for getting me pointed in the right direction!