PC Review


Reply
Thread Tools Rate Thread

Basing queries on a sub form

 
 
=?Utf-8?B?RWFtb25u?=
Guest
Posts: n/a
 
      7th Mar 2006

 
Reply With Quote
 
 
 
 
Ed Robichaud
Guest
Posts: n/a
 
      7th Mar 2006
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" <(E-Mail Removed)> wrote in message
news:A9EBE4AF-6745-499F-ADCC-(E-Mail Removed)...
>



 
Reply With Quote
 
 
 
 
=?Utf-8?B?RWFtb25u?=
Guest
Posts: n/a
 
      7th Mar 2006
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" <(E-Mail Removed)> wrote in message
> news:A9EBE4AF-6745-499F-ADCC-(E-Mail Removed)...
> >

>
>
>

 
Reply With Quote
 
chris.nebinger@gmail.com
Guest
Posts: n/a
 
      7th Mar 2006
The correct format to reference a field on a subform is

Forms("FormName").Controls("SubFormControlName").Form.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

 
Reply With Quote
 
Ed Robichaud
Guest
Posts: n/a
 
      7th Mar 2006
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" <(E-Mail Removed)> wrote in message
news:9000821A-902A-4C53-8D43-(E-Mail Removed)...
> 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" <(E-Mail Removed)> wrote in message
>> news:A9EBE4AF-6745-499F-ADCC-(E-Mail Removed)...
>> >

>>
>>
>>



 
Reply With Quote
 
=?Utf-8?B?RWFtb25u?=
Guest
Posts: n/a
 
      8th Mar 2006
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" <(E-Mail Removed)> wrote in message
> news:9000821A-902A-4C53-8D43-(E-Mail Removed)...
> > 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" <(E-Mail Removed)> wrote in message
> >> news:A9EBE4AF-6745-499F-ADCC-(E-Mail Removed)...
> >> >
> >>
> >>
> >>

>
>
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Can you do a sub-Form in a sub-Form ?? (Nest sub-Forms) MyEmailList@gmail.com Microsoft Access 2 25th Apr 2007 03:34 PM
main form, sub form, sub sub form ...etc =?Utf-8?B?RGF3blRyZWFkZXI=?= Microsoft Access Form Coding 8 5th Nov 2006 05:26 AM
Basing Forms on Queries =?Utf-8?B?Um9iZXJ0IFQ=?= Microsoft Access Queries 4 6th Jun 2006 01:08 AM
Improve performance by basing sub forms & combo boxes on queries =?Utf-8?B?Sm9obiBQaGVsYW4=?= Microsoft Access Forms 2 8th May 2006 11:12 PM
Basing a report on mulptiple queries =?Utf-8?B?Sm9hbm5l?= Microsoft Access Reports 7 23rd Mar 2006 06:46 PM


Features
 

Advertising
 

Newsgroups
 


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