0
votes

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
Why open query? Open form or report instead.June7
Form is what I meant, I changed it.beannshie
That is the RecordSource for the form you want to open? Maybe SELECT * FROM Customers WHERE FirstName = Forms!Form1.Text4. What is your code to open the form? I never use dynamic parameterized query. I prefer VBA to set form or report filter: DoCmd.OpenForm "formname", , , "FirstName='" & Me.Text4 & "'"June7
I am very new to sql and access so I don't really know anything apart from some sql.beannshie
If you haven't suggest you spend a week with an introductory tutorial book. What I described is basic Access functionality. Also review support.office.com/en-us/article/…June7

1 Answers

0
votes

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.