Why does Ms Access show the first record for a short time before switching to the right one?

风流意气都作罢 提交于 2020-01-06 04:59:47

问题


To reproduce do this steps. You only need the visual designer.

  1. create a simple table: (ID,txt)
  2. insert some records for testing
  3. create a form and use the table as datasource
  4. insert controls for ID, txt
  5. insert a listbox and choose option 3: The form must display the record that is choosen in the listbox

Now select a record other than the first one. You have to watch carefully. The form displays the tables first record for a very short time, before the choosen record is displayed.

  1. Why?
  2. How can I stop this?

Hint: For better see this effect, use a large txt control with "XXXXXXXXXXX" set in the first record.


回答1:


I guess you have created a macro. Don't, use code in the AfterUpdate event of the listbox:

' Set filter.
Me.Filter = "[ID] = " & Nz(Me!NameOfYourListBox.Value, 0) & ""
' Activate filter.
Me.FilterOn = True


来源:https://stackoverflow.com/questions/52072457/why-does-ms-access-show-the-first-record-for-a-short-time-before-switching-to-th

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!