How to open a specific form by clicking on a specific cell or row?

我的梦境 提交于 2019-12-25 12:45:52

问题


In Microsoft Access I made a form with a textbox and a query. Whatever is written in the textbox will be shown in the query (for example you type customer1 and the query displays all rows that have firstname(this is a column name) customer 1).
Now I'm trying to make it so that if you double click (or click) one of those rows(customers) it opens a form that only shows that specific row/customer instead of all customers with name customer1(for example).

Also this is my query code :

SELECT *
FROM Customers
WHERE Forms.[Form1].[Text4] IS NULL OR (Forms.[Form1].[Text4] = Forms.[Form1].[Text4] AND FirstName=Forms.[Form1].[Text4]);

Thank you for any help.


回答1:


If I'm understanding it correctly, you have a form with a textbox and a listbox(?) on it, 1, whenever there's a change in the textbox you want the listbox to refresh the display based on the query linked to the textbox value. 2, when there's a click or double click to the row of the listbox, you want to open another form with data filtered from the row value.

for 1, you can use event handler of the text box to refresh the display of the listbox, for the listbox you can attach a query to it based on the value of the textbox.

for 2, you can have event handler of "click" or "double click" to the listbox, and get the value of the row, and then open another predefined form and using the value for the row to filter the display.

hope that helps.



来源:https://stackoverflow.com/questions/46160452/how-to-open-a-specific-form-by-clicking-on-a-specific-cell-or-row

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