Quantcast
Channel: dBforums – Everything on Databases, Design, Developers and Administrators
Viewing all articles
Browse latest Browse all 13329

New Query hates old date formula & new yr-to-date

$
0
0
Here's a good one for you!

I've added several fields to a straight forward Access dB with a single data table. Once the new fields are added, Access decided it doesn't like a formula in an unrelated date field and I get an error message that says "the expression you entered has an invalid date value" when I go to save it.

Query runs fine without the new fields, there is no validation rules on the field, and the original formula was not touched. The only changes made to the query were a few new fields (true/false value, default settings). In all cases there is no relationship between the problem date field where the formula lives or the fields that were added.

Thought I had a fix from another forum where two new formula's were suggested. Problem is, the suggestions worked with some queries and not others.

Here's the query setup: I have sales status reports per principles (product line) that list each customer for that principle in ascending order, they are grouped by month. Amongst other fields displayed are sales and 2 commission amounts. The sales, commissions amounts are listed & totaled by each month per customer and grand totaled at the end of the report.

A status is either booked (b), forecast (f), shipped (s) or closed (c). The status isn't displayed because its the name of the report. The original query criteria is as follows, (runs fine displaying running totals):

customer status sales_comm(company) rep_comm(sales rep) book_date (substitute bill_date/revenue_date in those reports)
"b" >=#Sun Jan 01 2010# And <Date()+30

My [report] output is attached, I posted it here but it garbled.

For my new reports I added the following fields to my query: model/product description, revised quote number. My updated report with the and the model/product description, revised quote number fields should look the same as the original report but begin with Booking Cycle: month for a year earlier (in this case, June 2012). For the Forecast sales/billing report I should have results from Forecast Cycle June 2012 thru Dec 2014.

Instead, as soon as I add those fields, I got: "the expression you entered has an invalid date value", and could not save the query. In using alternate formulas, I still get nothing in some of my reports.

Some of my correction attempts and recommendations include the following:

>="Sun Jan 01 2012" And <Date()+30
which returns this error message
"this expression is typed incorrectly, or it is too complex to be evaluated. For example, a numeric expression may contain too many complicated elements. Try simplifying the expression by assigning parts of the expression to variables.

or
>= DateSerial(Year(Date()), 1, 1)
Between DateSerial(Year(Date()),Month(Date()),1) And Date()-1
or
Between CDate("1/1/2012") And Date() + 30
or
Between CDate("1/1/2012") And DateAdd("d", Date(), 30)
instead of >="Sun Jan 01 2012" And <Date()+30
or
Between DateAdd("d", -730, Date()) And DateAdd("d", 730, Date())
instead of >(date()-730) and <date()+730
or
>= CDate("1/1/2010")
instead of >="Fri Jan 01, 2010"


Here's my problem:
I have 16 reports/queries, about 5-6 of them return no results with the new formulas when I know I should have at least 10 records populate each report.

Nothing in the query has been modified except adding the new fields, the status value was unchanged; its the book/bill/or revenue date field that determines if records are displayed or not because the status field is constant and is never modified.

What I need:
(a) the report displays a running total, the new formulas don't error out but don't return any data, I need it to return data
(b) I need the report to display year-to-date totals, but in csae someone needs a running total (for historical purposes), I need a furnish them with a formula they can use to do a custom query becasue their original formula no longer works.

Report output attached.

Thanks in advance for the help and the fresh eyes!
:S

Attached Files
File Type: txt jethomas930_sample of query problem.txt (2.2 KB)

Viewing all articles
Browse latest Browse all 13329

Trending Articles