Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

access query time "expression is typed incorrectly, or it is too complex..."

Status
Not open for further replies.

rxsims

Technical User
Jul 14, 2003
34
CA
Hi -

I am currently exporting a data table out of a foxpro database which I have no access to modify. I export the data files into an excel spreadsheet, then copy and paste the data into a form in Access 2010. In the original data, there is a field "TIME" that is being recorded as text, not date/time.
I base many of my reports in this database off a query that takes this text format "time" field, and converts it do date/time using CDate(time). I have used this new field "TimeConverted" for max and min calculations within a query without problem.

Now I am trying to use a query to filter between two times and I'm getting the error "this expression is typed incorrectly, or it is too complex to be evaluated..."

In the query I am trying to use, I am already using three criteria fields without issue. I have also tried building a query to filter the time that is based on my original working query which has the three criteria. neither will work when I try to use any criteria in the TimeConverted field, whether I have a Time criteria from a form (which is what I want) or I manually put in a time filter, i.e. <#7:30:00 AM#

i have tried to put in a filter in the Time field (which I know is text format) and the query will run, but with no results, even though I know data exists within the parameters I've given it.

How do I get this query to work where I can ultimately use criteria "between [TimeStartFromFormField] and [TimeEndFromFormField] in either the Time field (text format) or CDate(Time field with is text formatted)?

Help is greatly appreciated.
 
hi,
I export the data files into an excel spreadsheet,
HOW do you do this?

If your EXPORT is to a text file and then you use the Workbooks.OpenText method, then Excel will CONVERT yout test to a Date/Time value.

Skip,
[sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 
Hi SkipVought,

The foxpro database is a compiled program which has an "export to .xls" function. I don't know what is happening in the background, but it creates an .xls file which I open then copy from then paste into the Access form. The Time field I'm looking at is in "General Number" format in the Excel file that is created, and looks like 05:30:00, but I cannot do any calculations on that field without converting it


using the CDate() function.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top