Display form without running query

exaccess

Registered User.
Local time
Today, 05:16
Joined
Apr 21, 2013
Messages
287
Hello to all,
I have a form with a select query running as record source. Once the input for the select query is entered the form runs. Then after that there are some manipulations in the form and it is displayed. In this second phase the form must be displayed without running the same query again. How can I do this? Any help is appreciated.
 
I can't get the idea what you are doing and why you are doing that.
Can you explain what you are trying to perform?
Set the record source for the form to an empty string (""), prevent the query from executing.
 
I can't get the idea what you are doing and why you are doing that.
Can you explain what you are trying to perform?
Set the record source for the form to an empty string (""), prevent the query from executing.

Yes of course. I have a table where I keep the names and other data of people. Some basic fields of every person of this whole table are displayed as a listbox on a single form. On the same form are also the detail fields of a single person. When the user goes in he sees the whole table in the listbox. If he wants he can click on a person in the listbox and see the details on the same form. There is no problem up to this point. Now it is possible that the user executes a query wants to get the results in the same format. Thus now the recordsource for the form changes. This is not a problem he can see the results. But when he wants to go into details of a person I have to display the form again and there the same query is reexecuted asking for input etc. This is what I am trying to avoid.
 
..
Now it is possible that the user executes a query wants to get the results in the same format.
But when he wants to go into details of a person I have to display the form again and there the same query is reexecuted asking for input etc. This is what I am trying to avoid.
Which query and what do the query do?
What do you mean about "get the results in the same format"?
Why do you need to display the form again - did you close it, (and which form)?
And if yes, why?
Again "there the same query is reexecuted asking for input etc" which query and where is it reexecuted?
Maybe a/some printscreen what you are doing would help to understand your problem - it sounds like it is done more complicated as necessary!
 
Which query and what do the query do?
What do you mean about "get the results in the same format"?
Why do you need to display the form again - did you close it, (and which form)?
And if yes, why?
Again "there the same query is reexecuted asking for input etc" which query and where is it reexecuted?
Maybe a/some printscreen what you are doing would help to understand your problem - it sounds like it is done more complicated as necessary!
The query searches using a given word. It can also be another query searching using a given a number. The search domain is the same. By saying get the results in the same format I mean in the same form. There is only one form displaying the results which is given in the attachment below. It is not closed it is refreshed to display the detail fields for the person chosen in the list.
 

Attachments

  • screenshot.5.jpg
    screenshot.5.jpg
    49.1 KB · Views: 98
Have you tried to set the record source for the form to the other query, and the requery the form?

Code:
  Me.RecordSource = "NameOfYourSecondQuery"
  Me.Requery
 
Have you tried to set the record source for the form to the other query, and the requery the form?

Code:
  Me.RecordSource = "NameOfYourSecondQuery"
  Me.Requery

I tried this but it says the db does not allow you to use this method. But in the meantime I have almost sorted out the problem as follows:

Code:
strSQL = "SELECT TelephoneAAA.*  FROM TelephoneAAA " & _
        "WHERE ((TelephoneAAA........;"
            
    Dim qdf As DAO.QueryDef
    CurrentDb.QueryDefs.Delete (ResultQy)
    Set qdf = CurrentDb.CreateQueryDef(ResultQy, strSQL)

    DoCmd.OpenForm ForName, acDesign, , , , acHidden
    Forms(ForName).RecordSource = ResultQy
    
    DoCmd.Close acForm, ForName, acSaveYes
    DoCmd.OpenForm ForName, acNormal, , , , , strSQL

I redefine the query and assign it to the form as recordsource. But now the problem is it executes the query twice once for the form and once for the rowsource of the listbox. This is probably something quite simple but I can not figure out what the problem is.
 
Post a stripped version of you database with some sample data, (zip it).
 

Users who are viewing this thread

Back
Top Bottom