A Microsoft Office (Excel, Word) forum. OfficeFrustration

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.

Go Back   Home » OfficeFrustration forum » Microsoft Access » New Users
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Basing queries on a sub form



 
 
Thread Tools Display Modes
  #1  
Old March 7th, 2006, 12:51 PM posted to microsoft.public.access.gettingstarted
external usenet poster
 
Posts: n/a
Default Basing queries on a sub form


  #2  
Old March 7th, 2006, 12:58 PM posted to microsoft.public.access.gettingstarted
external usenet poster
 
Posts: n/a
Default Basing queries on a sub form

It's difficult to answer a blank question, but based on your msg title, you
appear to have it backwards. Queries are based on tables and/or other
queries. Forms (including sub-forms) use those queries as their record
source.


"Eamonn" wrote in message
...



  #3  
Old March 7th, 2006, 02:01 PM posted to microsoft.public.access.gettingstarted
external usenet poster
 
Posts: n/a
Default Basing queries on a sub form

Apologies ED -thought I cut and pasted my question in but clearly didnt.

Basically I have a lot of VBA code set up so that a sub form will act as a
filter table and I want to be able to base some charts on that selection (ie
the contents of the subform). Now I can do this fine with a command button
linked to a query which draws the info from the main linked in .xls sheet.
However to save me writing a frightning amount of code if I could just get
the query to run of the subform it would be superb.

For my first graph a breakdown by country Ive managed to link the query on
to the form using

SELECT subform3.Country, Sum(subform3.[LCL CCY ALLOCATED]) AS [SumOfLCL CCY
ALLOCATED]
FROM sheet1 AS subform3
GROUP BY subform3.Country;

It s just when I run the query it pulls straight from the main sheet and
ignores my subform without any error message

Maybe I could have a table created that just from the subform and i could
run my query off that table.


Appreciate the help
Eamonn






"Ed Robichaud" wrote:

It's difficult to answer a blank question, but based on your msg title, you
appear to have it backwards. Queries are based on tables and/or other
queries. Forms (including sub-forms) use those queries as their record
source.


"Eamonn" wrote in message
...




  #4  
Old March 7th, 2006, 02:39 PM posted to microsoft.public.access.gettingstarted
external usenet poster
 
Posts: n/a
Default Basing queries on a sub form

The correct format to reference a field on a subform is

Forms("FormName").Controls("SubFormControlName").F orm.Controls("ControlName")

Keep in mind, the SubFormControlName is not the name of the form, but
rather, the name of the control on the form.


Chris Nebinger

  #5  
Old March 7th, 2006, 09:38 PM posted to microsoft.public.access.gettingstarted
external usenet poster
 
Posts: n/a
Default Basing queries on a sub form

Rather than jump through all the hoops you outline (exporting to Excel,
etc.) have you thought about using a pivotchart? Access has the same graph
engine as Excel. You could include all the same filter fields that are now
in your forms (and incidentally, sub-forms typically show records from the
many side of a relationship/link, e.g. main form shows single customer
record, while related subform shows all invoices for that customer) and let
your users dynamically change all the chart inputs.
-Ed

"Eamonn" wrote in message
...
Apologies ED -thought I cut and pasted my question in but clearly didnt.

Basically I have a lot of VBA code set up so that a sub form will act as a
filter table and I want to be able to base some charts on that selection
(ie
the contents of the subform). Now I can do this fine with a command button
linked to a query which draws the info from the main linked in .xls sheet.
However to save me writing a frightning amount of code if I could just get
the query to run of the subform it would be superb.

For my first graph a breakdown by country Ive managed to link the query on
to the form using

SELECT subform3.Country, Sum(subform3.[LCL CCY ALLOCATED]) AS [SumOfLCL
CCY
ALLOCATED]
FROM sheet1 AS subform3
GROUP BY subform3.Country;

It s just when I run the query it pulls straight from the main sheet and
ignores my subform without any error message

Maybe I could have a table created that just from the subform and i could
run my query off that table.


Appreciate the help
Eamonn






"Ed Robichaud" wrote:

It's difficult to answer a blank question, but based on your msg title,
you
appear to have it backwards. Queries are based on tables and/or other
queries. Forms (including sub-forms) use those queries as their record
source.


"Eamonn" wrote in message
...






  #6  
Old March 8th, 2006, 10:18 AM posted to microsoft.public.access.gettingstarted
external usenet poster
 
Posts: n/a
Default Basing queries on a sub form

G Morning,

Appols ED if I wasnt clear but I am actually using the pivot chart view for
my graphs in Access. Problem is my query while populating my graph
automatically from a cmd button on the form will use all data in my form as
opposed to the filtered data in my subform.

Chris I'm fairly new (about a month) to Access/SQL/VBA could you possible
just tell me what exactly I have to write

given

Form name = "Copy of formqs"
Subform name= "sheet1 subform3"
For my first graphing query I want to sort by "Country"

tried your code but couldnt get it working


Thanks guys
-Eamonn

"Ed Robichaud" wrote:

Rather than jump through all the hoops you outline (exporting to Excel,
etc.) have you thought about using a pivotchart? Access has the same graph
engine as Excel. You could include all the same filter fields that are now
in your forms (and incidentally, sub-forms typically show records from the
many side of a relationship/link, e.g. main form shows single customer
record, while related subform shows all invoices for that customer) and let
your users dynamically change all the chart inputs.
-Ed

"Eamonn" wrote in message
...
Apologies ED -thought I cut and pasted my question in but clearly didnt.

Basically I have a lot of VBA code set up so that a sub form will act as a
filter table and I want to be able to base some charts on that selection
(ie
the contents of the subform). Now I can do this fine with a command button
linked to a query which draws the info from the main linked in .xls sheet.
However to save me writing a frightning amount of code if I could just get
the query to run of the subform it would be superb.

For my first graph a breakdown by country Ive managed to link the query on
to the form using

SELECT subform3.Country, Sum(subform3.[LCL CCY ALLOCATED]) AS [SumOfLCL
CCY
ALLOCATED]
FROM sheet1 AS subform3
GROUP BY subform3.Country;

It s just when I run the query it pulls straight from the main sheet and
ignores my subform without any error message

Maybe I could have a table created that just from the subform and i could
run my query off that table.


Appreciate the help
Eamonn






"Ed Robichaud" wrote:

It's difficult to answer a blank question, but based on your msg title,
you
appear to have it backwards. Queries are based on tables and/or other
queries. Forms (including sub-forms) use those queries as their record
source.


"Eamonn" wrote in message
...







 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Customers- Contracts form problem GL Using Forms 10 February 7th, 2006 04:05 PM
strategy for data entry in multiple tables LAF Using Forms 18 April 25th, 2005 04:04 AM
dlookup miaplacidus Using Forms 9 August 5th, 2004 09:16 PM
Searching Records Melissa Lambino New Users 6 July 20th, 2004 04:51 AM
auto entry into second table after update Tony New Users 13 July 9th, 2004 10:42 PM


All times are GMT +1. The time now is 07:01 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.