If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Control Button to Run Query Off of a Form
I have a form, which is really a form/subform:
form: File information subform: Contact information (1:many relationship -- 1 file can have many contacts) When on the subform, I want to execute a query from a control button which will bring up the many transactions associated with the Contact. I can run the query, but it shows the results for each contact, not the one appearing on the subform. How do I get the control button to reference the specific contact ID so that when the query runs, it only shows the contact's transactions. |
#2
|
|||
|
|||
Control Button to Run Query Off of a Form
The query's select statement need to have a where clause that reads from the
form: Select * From MyTable Where CustomerID = Forms!MyForm!MySubformControlName.Form!txtContactI D or in code: "Select * From MyTable Where CustomerID =" & Forms!MyForm!MySubformControlName.Form!txtContactI D -- Arvin Meyer, MCP, MVP http://www.datastrat.com http://www.mvps.org/access http://www.accessmvp.com "Uninvisible" wrote in message oups.com... I have a form, which is really a form/subform: form: File information subform: Contact information (1:many relationship -- 1 file can have many contacts) When on the subform, I want to execute a query from a control button which will bring up the many transactions associated with the Contact. I can run the query, but it shows the results for each contact, not the one appearing on the subform. How do I get the control button to reference the specific contact ID so that when the query runs, it only shows the contact's transactions. |
#3
|
|||
|
|||
Control Button to Run Query Off of a Form
Works perfectly.
Thank you Arvin. Arvin Meyer [MVP] wrote: The query's select statement need to have a where clause that reads from the form: Select * From MyTable Where CustomerID = Forms!MyForm!MySubformControlName.Form!txtContactI D or in code: "Select * From MyTable Where CustomerID =" & Forms!MyForm!MySubformControlName.Form!txtContactI D -- Arvin Meyer, MCP, MVP http://www.datastrat.com http://www.mvps.org/access http://www.accessmvp.com "Uninvisible" wrote in message oups.com... I have a form, which is really a form/subform: form: File information subform: Contact information (1:many relationship -- 1 file can have many contacts) When on the subform, I want to execute a query from a control button which will bring up the many transactions associated with the Contact. I can run the query, but it shows the results for each contact, not the one appearing on the subform. How do I get the control button to reference the specific contact ID so that when the query runs, it only shows the contact's transactions. |
Thread Tools | |
Display Modes | |
|
|