Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

MULTIPLE QUERIES LINKS TO THE SAME FORM

Status
Not open for further replies.

danielcan

Technical User
Jul 6, 2007
15
0
0
CA
Good day all.

Here is my delemma.

I have one form, with lets say for the example, 10 fields.
I want to be able to click on a field and run a query for that field. Each field has a different query attached to it. Whatever query i would run, it would always populate the same form.
Right now I have created ten forms with macros. "when click run macro(closed window, open form(record source query X).

If that makes sense. I know I will probably hit myself for that simple solution, but right now I can see past my own labyrinth.

Daniel Belanger
 
Have you considered code, rather than macros?
 
I am looking at that solution. But my knowledge is not advanced has I would like it to be. I dont known if I should go with "dim record set" or controlsource= field name.

Daniel Belanger
 
Can you post an example of a query you wish to run?

You will find that each form control has a variety of events, including a click event. For the most part, it is not a good idea to run much in a click event, the double-click event is usually safer.

An example or two:
Code:
Private Sub txtText_DblClick(Cancel As Integer)
DoCmd.OpenQuery "qryQuery"
End Sub

Code:
Private Sub txtText_DblClick(Cancel As Integer)
strSQL="Update tblTable Set Field1='ABC'"
DoCmd.RunSQL strSQL
End Sub

Note that you can save macros as code.
 
basically your have crossing number field, street, cross street etc.

The timing of the action is as follow, close the form, open the query window that shows the question to enter [what is the crossing number] than field are populated by answer.

It is relatively simple action when you click. It launches the query. each field as a different query. But I want to use only one form if possible.

Daniel Belanger
 
This may be easier that it seems. Are you aware that you can create a combobox that finds records on a bound form? There is even a wizard to guide you through the process.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top