Passing value of a form control in the Row Source to a Chart

  • Thread starter Thread starter MSROOKIE
  • Start date Start date
M

MSROOKIE

I initially passed a value to a chart via this SQL statement:

SELECT Format([Extract AAPL Interval Data].[Date],"0.00000") AS Datefmt,
[Extract AAPL Interval Data].Open, [Extract AAPL Interval Data].High,
[Extract AAPL Interval Data].Low, [Extract AAPL Interval Data].Close
FROM [Extract AAPL Interval Data]
WHERE ((([Extract AAPL Interval Data].Date)<=[Trade Prices_Date]+#12/30/1899
1:0:0# And ([Extract AAPL Interval Data].Date)>=[Trade
Prices_Date]-#12/30/1899 1:0:0#));

Trade Prices_Date is the value being passed. Everything worked fine.
However when I changed the table field name, I had to change the query,
changing "Trade Prices_Date]" to [BTO DT].

It was at this point the when I started being prompted for the parameter
[BTO DT].

Eventually I had to change the reference of "BTO DT" to
"[Forms]![PlaysByBar_Chart]![BTO DT]" to get it to work.

Questions are....
1. How do I pass this parameter into the query without having to qualify
with the form name?
2. Any idea why the first one worked, but then quit working?
3. Any pointers on using the ! (which I get so confused on) would be helpful.

Thanks.
 
Agreeded that using a field name of Date is not a very good idea, in the
process of changing it. But the new query works even using the [Date].

Evi said:
You have the word Date in your Query. If that is a field name, then it could
be causing your problem - and if it isn't causing this problem, will
probably cause a problem at some future date. It's the name of a Function in
Access. There is a list of Reserved Words here
http://www.databasedev.co.uk/ms-access-reserved-words.html

Evi

MSROOKIE said:
I initially passed a value to a chart via this SQL statement:

SELECT Format([Extract AAPL Interval Data].[Date],"0.00000") AS Datefmt,
[Extract AAPL Interval Data].Open, [Extract AAPL Interval Data].High,
[Extract AAPL Interval Data].Low, [Extract AAPL Interval Data].Close
FROM [Extract AAPL Interval Data]
WHERE ((([Extract AAPL Interval Data].Date)<=[Trade Prices_Date]+#12/30/1899
1:0:0# And ([Extract AAPL Interval Data].Date)>=[Trade
Prices_Date]-#12/30/1899 1:0:0#));

Trade Prices_Date is the value being passed. Everything worked fine.
However when I changed the table field name, I had to change the query,
changing "Trade Prices_Date]" to [BTO DT].

It was at this point the when I started being prompted for the parameter
[BTO DT].

Eventually I had to change the reference of "BTO DT" to
"[Forms]![PlaysByBar_Chart]![BTO DT]" to get it to work.

Questions are....
1. How do I pass this parameter into the query without having to qualify
with the form name?
2. Any idea why the first one worked, but then quit working?
3. Any pointers on using the ! (which I get so confused on) would be helpful.

Thanks.
 
Wow, no other ideas? Is there no way I can refer to a field on the form in a
recordset query besides using the form name?
 
Back
Top