Expression Problem

J

Jeff C

I am struggling with the following:

dateserial(Year([Current Test]),Month([Current
Test]),1)=dateserial(Year(Date())-1),(Month(Date())+1)

I am using this in the criteria: of a date field named [Current Test] in a
query. I am trying to return dates from Feb2004. I have written and
re-written a dozen times and can't get it to work. Anyone tell me what I am
doing wrong? Thank You.
 
A

Andi Mayer

I am struggling with the following:

dateserial(Year([Current Test]),Month([Current
Test]),1)=dateserial(Year(Date())-1),(Month(Date())+1)

I am using this in the criteria: of a date field named [Current Test] in a
query. I am trying to return dates from Feb2004. I have written and
re-written a dozen times and can't get it to work. Anyone tell me what I am
doing wrong? Thank You.


go to the immidiate window and try your expresesion

?dateserial(Year(Date())-1,Month(Date())+1,1)
01.02.2004

there you will find your bracket-errors and others, but note:
this works for vba, in a field expression or in the query-view there
are a few differences like:
comma is a [;]
date nedds the brackets as Date() ............
 
J

Jeff C

So you are telling me that instead of what I used I need to use

?dateserial(Year(Date())-1,Month(Date())+1,1) 01.02.2004


???


Andi Mayer said:
I am struggling with the following:

dateserial(Year([Current Test]),Month([Current
Test]),1)=dateserial(Year(Date())-1),(Month(Date())+1)

I am using this in the criteria: of a date field named [Current Test] in a
query. I am trying to return dates from Feb2004. I have written and
re-written a dozen times and can't get it to work. Anyone tell me what I am
doing wrong? Thank You.


go to the immidiate window and try your expresesion

?dateserial(Year(Date())-1,Month(Date())+1,1)
01.02.2004

there you will find your bracket-errors and others, but note:
this works for vba, in a field expression or in the query-view there
are a few differences like:
comma is a [;]
date nedds the brackets as Date() ............
 
J

Jeff C

How do you get the "immediate window"

Sorry but I am 3 months old in Access, never heard of immediate window

Andi Mayer said:
I am struggling with the following:

dateserial(Year([Current Test]),Month([Current
Test]),1)=dateserial(Year(Date())-1),(Month(Date())+1)

I am using this in the criteria: of a date field named [Current Test] in a
query. I am trying to return dates from Feb2004. I have written and
re-written a dozen times and can't get it to work. Anyone tell me what I am
doing wrong? Thank You.


go to the immidiate window and try your expresesion

?dateserial(Year(Date())-1,Month(Date())+1,1)
01.02.2004

there you will find your bracket-errors and others, but note:
this works for vba, in a field expression or in the query-view there
are a few differences like:
comma is a [;]
date nedds the brackets as Date() ............
 
J

Jeff C

I got it...Thank You Andi

Andi Mayer said:
I am struggling with the following:

dateserial(Year([Current Test]),Month([Current
Test]),1)=dateserial(Year(Date())-1),(Month(Date())+1)

I am using this in the criteria: of a date field named [Current Test] in a
query. I am trying to return dates from Feb2004. I have written and
re-written a dozen times and can't get it to work. Anyone tell me what I am
doing wrong? Thank You.


go to the immidiate window and try your expresesion

?dateserial(Year(Date())-1,Month(Date())+1,1)
01.02.2004

there you will find your bracket-errors and others, but note:
this works for vba, in a field expression or in the query-view there
are a few differences like:
comma is a [;]
date nedds the brackets as Date() ............
 
Top