473,385 Members | 1,326 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Undefined function 'Date' in expression.

This is exactly the error message I get when trying to run a query in Access 2013 on a Windows 7 Machine (I have run very successfully for many months). All of a sudden it has stopped working and I have no idea why.

I have been through some of the advice already posted about references and unchecking any that contain the word "MISSING" (I only have 4 libraries checked and none contain the word missing).

I have tried adding more references and coming back out to test run - sadly this does not work. I have removed all the reference libraries that I can and re-tried - sadly this does not work either.

The formula I am using is along the lines of >=Date()-(IIf(Weekday(Date())>=6,Weekday(Date())-6,Weekday(Date())+1))-35 (so that I get a specific rolling range always starting on a Friday). Like I say I have been using these for many months and no issue until yesterday, when it appeared sporadic but today it is affecting everything and other peoples' databases using similar formulae.

Has some update been put through stopping me using this formula?

If I change this to an actual date range it works fine but I have many queries within the database and changing them all on a weekly basis is something i would much rather avoid.

can anyone help?

Please?!?
Oct 7 '16 #1
9 4642
jforbes
1,107 Expert 1GB
Where is this formula located? Is it in a SQL statement where clause or on a Form Control? In code? Could you provide the entire formula/SQL statement/code?
  • Missing references are often a cause of this, but sounds like you have that covered.
  • Make sure your project compiles.
  • Perform a Find on all of your code for "Date". You'll get a lot of results, but you may find that you have created, imported, copied and pasted a Date() method from the internet or someplace else.
  • If this is in a SQL statement, it maybe because of an error at a previous point in the SQL, or by skipping a required Keyword, like FROM tTable
  • You can try to include the Namespace, DateTime.Date() and see if your error goes away. If it does, then it means you have a problem with name resolution and nearly for sure have another method with the name of Date(). If it doesn't then it probably means the error is actually somewhere else in the Function/SQL.
Oct 7 '16 #2
Oralloy
988 Expert 512MB
You might want to try the function Now(), but I am shooting from the hip, so this may not be a valid suggestion.
Oct 8 '16 #3
PhilOfWalton
1,430 Expert 1GB
I had that problem recently as well. I think I cured it by doing a decompile.

Phil
Oct 8 '16 #4
Hi.

It's within the Criteria line of the Design View of the query.

The SQL looks like :
SELECT [Date LookUp].Year, [Date LookUp].Week, SCT.[Metric Date], [Date LookUp].Day, SCT.[Service Group 1 Name], SCT.[Service Group 2 Name], SCT.[Service Group 3 Name], SCT.[Service Call Type], Sum(SCT.[Calls Offered]) AS [SumOfCalls Offered], Sum(SCT.[Calls Answered Count]) AS [SumOfCalls Answered Count], Sum([SCT]![Calls Offered]-[SCT]![Calls Answered Count]) AS Abandoned, Sum([SCT]![Connected Duration]+[SCT]![Hold Duration]+[SCT]![Acw Duration]) AS THT, Sum(SCT.[Connected Duration]) AS [SumOfConnected Duration], Sum(SCT.[Hold Duration]) AS [SumOfHold Duration], Sum(SCT.[Acw Duration]) AS [SumOfAcw Duration], Sum(SCT.[Total Time To Answer]) AS [SumOfTotal Time To Answer]
FROM SCT INNER JOIN [Date LookUp] ON SCT.[Metric Date] = [Date LookUp].Date
GROUP BY [Date LookUp].Year, [Date LookUp].Week, SCT.[Metric Date], [Date LookUp].Day, SCT.[Service Group 1 Name], SCT.[Service Group 2 Name], SCT.[Service Group 3 Name], SCT.[Service Call Type], [Date LookUp].[Yr & Wk]
HAVING (((SCT.[Metric Date])>=#9/2/2016#) AND ((SCT.[Service Group 1 Name]) Not In ("SG1_BUS_Business","SG1_DEFAULT","SG1_NOW_TV","SG 1_OTH_Non_Specific","SG1_SAL_Sales","SG1_SAL_Sales _ROI","SG1_SBC_BusinessCloud","SG1_SCH_SupplyChain ","SG1_SER_Service_ROI","SG1_SkyQ_ROI")))
ORDER BY SCT.[Metric Date], [Date LookUp].[Yr & Wk];


What I really don't understand is that nothing has changed in the Db and it has only recently started happening. I also have another DB with similarly set out date ranges in queries and they DO work. I can't work out where the difference is :(
Oct 10 '16 #5
I don't know much about Access at the minute. What is a decompile and how do I do it please?
Oct 10 '16 #6
PhilOfWalton
1,430 Expert 1GB
I use a little batch file that creates a copy of my existing database "Test" and calls it "Decompile Test".

In the batch file there is a switch which says /Decompile which tells Access to decompile the newly copied database.

At the end of the procedure, I rename the original database "Test 10 Oct 2016", and rename "Decompile Test" back to "Test"

This is my batch file that can be edited with Notepad.

Expand|Select|Wrap|Line Numbers
  1. Copy "E:\Phil Data\Access\MDB 2010\Test.accdb", "E:\Phil Data\Access\MDB 2010\Decompile Test.accdb"
  2. "E:\Program Files (X86)\Microsoft Office\Office14\MSACCESS.EXE" "E:\Phil Data\Access\MDB 2010\Decompile Test.accdb" /decompile
  3.  
Phil
Oct 10 '16 #7
jforbes
1,107 Expert 1GB
To Decompile/recompile a database, I usually {Windows}+R (to open up the Run Dialog Box) and then use:
Expand|Select|Wrap|Line Numbers
  1. msaccess /decompile
Access will open, and will decompile the first database that is opened. So then, I open the troublesome database from the Recent Documents.
Oct 10 '16 #8
jforbes
1,107 Expert 1GB
You've got a field named "Date". Date is a reserved word in SQL. You can technically use "Date" to name an object, but it is not recommended. You would be better off with something like "ActionDate", "CreateDate", or "SchedDate".

I would rename your field if at all possible.

You can use reserved words if you Bracket them the way you bracketed the Table name with spaces. It's very possible that this will fix your Query:
Expand|Select|Wrap|Line Numbers
  1. FROM SCT INNER JOIN [Date LookUp] ON SCT.[Metric Date] = [Date LookUp].[Date]

Again, I would rename your field if at all possible.
Oct 10 '16 #9
Hi, all. Thanks for your all your help.

I tried a couple of these and couldn't get them to work in the way I wanted so I ended up recreating the Database from scratch.

This seemed to do the trick. Access really confuses me...
Oct 13 '16 #10

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Simon | last post by:
Dear reader, According the manuals it has to be possible to work with "Format" in queries. But in case I use the following expression in a query: Format(;"yyyy-mm-dd") Or...
3
by: carrionk | last post by:
Hi, I'm running an ADO Recorset from Excel to gather data from Access. Basically it's copying the records of a query -that runs without problem in Access- That query has an expression with NZ()...
8
by: Wade | last post by:
My query contains a field called TotalIn, which returns number data from an underlying table. I have modified a function, PrevRecVal, which returns the datum form the previous record in the TotalIn...
3
patjones
by: patjones | last post by:
Good morning all: In what seems like an ongoing saga to make the DSum function do what I need it to, I am now having trouble with a user-defined function in my VBA module. Here's the offending...
6
by: blackdogharry | last post by:
Hi, I am a novice VBA user. My access version is 2007 on Windows XP PC. I need to create a query that will take pre-existing text values of the B_status field (such as "Received_Emailed",...
2
by: CCHDGeek | last post by:
I created a database with a separate front-end that is installed on each computer and linked to a back-end server. After installing the file on several computers, I realized I was getting this...
2
by: rmmahara | last post by:
Hi Folks, I've been reading these forums for a while and now I'm in desperate need of help, so I thought I'd post! Background: I'm creating a Service Dashboard to track my team's adherence...
1
by: nlulla | last post by:
Hi I am trying to get all rows from a datatable where the first column F1 is a date, as this datatable is created of excel, i only want to deal with rows where the first column is having a date in...
6
Seth Schrock
by: Seth Schrock | last post by:
I'm getting an error when trying to open my database on a user's PC: Undefined Function 'Date' in Expression. From looking online, it looks like it is a reference issue. The problem is that the...
0
by: sous | last post by:
Hello I have a function called fCompareStrings Public Function fCompareStrings(strSource As String, strSearch As String) As Single Dim intCounter As Integer Dim strTest As String Dim...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.