Solved How to close query in accde and go back to form (1 Viewer)

Tea

Member
Local time
Today, 21:57
Joined
Oct 30, 2020
Messages
51
Hi,

so I have this form, where I can choose from the option buttons and input date in textfields after that I click on the button "Show data" and it opens a query based on the filter I made on my form. Except after I get the data I can't go back to the previous form in the accde version without closing the whole database. In accdb I can just close the query by clicking the x.

Is there a way to close the query in the accde file without closing the whole database?

Thank you.
 

Mike Krailo

Well-known member
Local time
Today, 15:57
Joined
Mar 28, 2020
Messages
1,043
I would try building a form and open that using SQL string as record source.
 

bob fitz

AWF VIP
Local time
Today, 20:57
Joined
May 23, 2011
Messages
4,719
Perhaps you could use a form, with the query as its' Record Source, to present the data to the user
 

Tea

Member
Local time
Today, 21:57
Joined
Oct 30, 2020
Messages
51
Perhaps you could use a form, with the query as its' Record Source, to present the data to the user
I've thought about it, but I forgot to mention, that I would like to manipulate with the data later on, e.g. copy the data to a file or filter it however i want later on in the query. I've created a button in my form with that I can export the data in excel file, but I would like to know if there was some other options...
 

gemma-the-husky

Super Moderator
Staff member
Local time
Today, 20:57
Joined
Sep 12, 2006
Messages
15,651
if you have a form when you choose you may be doing this sequentially

Code:
if openquery then
   showquery
else
  openform
end if
'WAIT HERE
..
...

if you do this, your program will only do either the query or form, but won't do both.

if you have an option group and a button, then on the button click you can do this

Code:
select case grpOpen
case 1:   showquery
case 2:  openform
end if
'WAIT HERE
....
...

Now the code will still run in the background, so it might be that when you open either the query or the form, you need to stop your calling form from doing anything else until you close the query or the form. One way to do this is to open the query and form in dialog mode. The dialog setting effectively adds a 'WAIT HERE where I have indicated.
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Tomorrow, 03:57
Joined
May 7, 2009
Messages
19,230
If you have the "source" db, it would easy to create a subform out of the query and put it on the Main form.
 

Users who are viewing this thread

Top Bottom