CDate Help.....please

Sep 30, 2005

I am trying to do date calculations, but when I generated my query to run the report off of I lost my formating and all my cells turned to text. I have tried to search this problem down and it seems that I could use the CDate function to correct my cells, but I am unsure how to use it.

My query (Report General Query) is based on two separate queries (General Protocol Query Pull Dates 1-9 and 10-60). It appears that the formatting is correct in the two separate queries, but turns to text when combined into the final query.

How do I correct this and where do I need to do this? In the Report General Query?

View Replies


ADVERTISEMENT

CDate Function In Query

Apr 2, 2008

I am using CDate to convert a date text string into a date value, which is then listed in ascending order in the result.

If I leave the default format as 'dd/mm/yy' the data is in the correct date ascending order when the query runs but if I use -

Format(CDate(etc, etc),"dd mmm yy")

The query is in alpha/numeric order as if the value is a text string and not a date value.

Not entirely sure why it is doing this when all that I have changed/added is the 'Format' function.

View 5 Replies View Related

Modules & VBA :: CDate - Converting String Into Date

Nov 12, 2013

I would like to convert 2013.11.13 which is a string into a date. This is what i have so far but it's not working.

2013 year

11 month
13 day of week
Dim strDate As String, dteConvertedDate As Date
strDate = 2013.11.13
dteConvertedDate = CDate(Mid$(strDate, 6, 2) & "/" & Left$(strDate, 4) & "/" & Right$(strDate, 8))
MsgBox (dteConvertedDate)
End Sub

View 7 Replies View Related

Queries :: Datatype Mismatch In Criteria Expression Regarding A CDate Function Field

Jun 25, 2014

I have this linked table query from a OBDC and I need to be able to filter out specific dates in that query. The dates in the table were in text format and I converted the dates using the CDate function. I wanted to filter the query to a single date and always I get the Datatype mismatch in criteria expression error.

However, filtering dates does work only when there are other specifications in the criteria fields (e.g. if I specify a date and and name). My SQL code in error looks like this:

SELECT
purch_hist.PUITM AS ITEM,
purch_hist.PUPO AS PO,
purch_hist.PUQTY AS QTY_RECEIVED,
CDate([purch_hist.PURDT]) AS RECEIPT_DATE,
itmcnt.ITBYR AS BUYER,
purch_hist.PUCST AS UNIT_COST,
vendor.NVNO AS VENDOR NO,

[code]...

This query works fine with a non converted date field, however the dates I need are in text format and need to be converted since I do not have permissions to edit the tables.

View 14 Replies View Related

Queries :: Importing Excel Text Field Into A Table - CDate Function?

Apr 28, 2014

I am importing an excel text field into a table. I am then appending the data to another table. I am having a hard time with the Cdate function

Excel Date Field:
YYYY.MM.DD HH:MM:SS

Example Value:
2014.04.21 18:24:30

My Query Code:

NewDate: CDate(Left([DateQ],4)+"/"+Mid([DateQ],6,2)+"/"+Right([DateQ],2))

My Query Result:
4/30/2014

What it should be:
04/21/2014

View 12 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved