Undefined Function "date expression

josros60

Well-known Member
Joined
Jun 27, 2010
Messages
786
Office Version
  1. 365
Ï am getting the above error undefined function when i run the form or query,

here it's sql view:


Code:
SELECT RATE.RATEID, RATE.COMPANY, RATE.COMPANYID, RATE.ENDINGDATE, RATE.SINGLEDOUBLE, RATE.GROUPRATE, RATE.TRIPLE, RATE.QUAD, RATE.SUITE, RATE.COMP, RATE.BFAST, RATE.COMMENTS
FROM RATE
WHERE (((RATE.STARTINGDATE)>=DateValue("1/1/" & Year(Date())) And (RATE.STARTINGDATE)<=DateValue("12/31/" & Year(Date())+1)) AND ((RATE.ENDINGDATE) Is Not Null))
ORDER BY RATE.STARTINGDATE, RATE.ENDINGDATE DESC;
thank you
 

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce
Works for me in access. How are you running the query? Is it in access?
 
Upvote 0
RATE is a built in function so it is an Access Reserved Word and you would need to therefore use square brackets around it in any place you use it.
 
Upvote 0
How would I do that in sql view query to fix it, can you show me how?
thank you
 
Upvote 0
Code:
select [rate].rateid, [rate].company, ...
From [rate] 
where ((([rate].startingdate) ...
 
Upvote 0
Thank you.

I put the [] on each one contataining the rate word, but keep gettting same error, I noticed though that when i run the query takes the brackets off again.

thanks you

here what I did:

Code:
SELECT[RATE].RATEID, [RATE].COMPANY, [RATE].COMPANYID, [RATE].ENDINGDATE, [RATE].SINGLEDOUBLE, [RATE].GROUPRATE, [RATE].TRIPLE, [RATE].QUAD, [RATE].SUITE, [RATE].COMP, [RATE].BFAST, [RATE].COMMENTS
FROM [RATE]
WHERE ((([RATE].ENDINGDATE) Is Not Null) AND (([RATE].STARTINGDATE)>=DateValue("1/1/" & Year(Date())) And ([RATE].STARTINGDATE)<=DateValue("12/31/" & Year(Date())+1)))
ORDER BY [RATE].STARTINGDATE, [RATE].ENDINGDATE DESC;
 
Upvote 0
I think datevalue should be available as a vba function. Be sure you have the reference to it correctly set.

Also make sure you've not gone and created a custom function of your own called datevalue().

1) Alt + F11 to drop into the code editor
2) Tools | References
3) Make sure visual basic for applications is checked

(ignore the fact that I have VBScript Regular Expressions checked in my example - that's not usually needed)

<img alt="refernces" src="http://northernocean.net/etc/mrexcel/20110428_refs.png" />
 
Last edited:
Upvote 0
You also could attempt instead a DateSerial based function (though that's a vba function, too, I think):
Code:
>=DateSerial(Year(Date()),1,1) 
AND < DateSerial(Year(Date())+1,1,1)

Which would be all dates between Jan 1 and Dec 31 of the current year.
 
Upvote 0
the weird thing is that i took the program at home from work, and at home I don't have that issue it opens fine.

I wonder why at work still saying the same thing.

I home same version of Access 2003 bu windows xp, at work is Windows 7 home.

this is driving me crazy why at home works and at work get that error.
thanks for your help
 
Upvote 0

Forum statistics

Threads
1,224,568
Messages
6,179,598
Members
452,927
Latest member
whitfieldcraig

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top