Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Forms / November 2007

Tip: Looking for answers? Try searching our database.

query run in subform and not in separate window

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
c8tz - 07 Nov 2007 09:52 GMT
hi,

i've created my form and have a query that runs within a subform.
This is working fine except that the same query runs in a separate
window also.
How do I prevent the separate window from opening but only run within
the subform.

thanks heaps
Douglas J. Steele - 07 Nov 2007 12:32 GMT
What do you mean by having "a query that runs within a subform"?

What are you doing to run it?

What kind of query is it? If it's a SELECT query, typically you'd set it as
the RecordSource for the form being used as the subform, and not run it. If
it's an Action query (INSERT INTO, DELETE, UPDATE, SELECT ... INTO), you
wouldn't typically have anything displayed on the form.

Signature

Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)

> hi,
>
[quoted text clipped - 5 lines]
>
> thanks heaps
c8tz - 08 Nov 2007 01:40 GMT
On Nov 7, 10:32 pm, "Douglas J. Steele"
<NOSPAM_djsteele@NOSPAM_canada.com> wrote:
> What do you mean by having "a query that runs within a subform"?
>
[quoted text clipped - 20 lines]
>
> - Show quoted text -

DoCmd.SetWarnings False
DoCmd.OpenQuery "AppendTrialFerts"
DoCmd.OpenQuery "AppendBasalFerts"

DoCmd.OpenQuery "TrialFerts"
Me!TrialFertilizerReqs.Form.Requery
Me!TrialFertilizerReqs.Form.Refresh
TrialFertilizerReqs.Visible = True

This is the code that I put in for the command button to open the
query within the form. This works well but the query also opens up in
a separate window. I would like only for the query to open in the
subform but not in the separate query window.

thanks
Douglas J. Steele - 08 Nov 2007 11:56 GMT
If TrialFerts is the recordsource for the subform, there's no reason to use
OpenQuery on it. Simply remove that line of code.

Assuming that AppendTrialFerts and AppendBasalFerts are action queries
(Append, Delete, Update or Make Table), OpenQuery isn't a great way to run
them. Instead, use:

CurrentDb.QueryDefs("AppendTrialFerts").Execute dbFailOnError
CurrentDb.QueryDefs("AppendBasalFerts").Execute dbFailOnError

That has the advantage of not popping up the message saying "n records are
going to be append, do you want to continue?", plus will generate a
trappable error if something goes wrong running the query.

Signature

Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)

> DoCmd.SetWarnings False
> DoCmd.OpenQuery "AppendTrialFerts"
[quoted text clipped - 9 lines]
> a separate window. I would like only for the query to open in the
> subform but not in the separate query window.
c8tz - 12 Nov 2007 04:02 GMT
On Nov 8, 9:56 pm, "Douglas J. Steele"
<NOSPAM_djsteele@NOSPAM_canada.com> wrote:
> If TrialFerts is the recordsource for the subform, there's no reason to use
> OpenQuery on it. Simply remove that line of code.
[quoted text clipped - 29 lines]
>
> - Show quoted text -

thanks for your help...... i initially thought the openquery was
needed to actually run the query.. it works fine now.
with the append queries i used docmd.show warnings false and
then ..... warnings true at the end.

thanks heaps again.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.