Why does this not work (selecting a date) ?

SELECT CDate((Month(RecordDate) & '/' & Day(RecordDate) & '/' & 
Year(RecordDate)) AS RecDate

This converts 8/31/2007 to 8/1/2007
0
Utf
9/6/2007 2:56:07 PM
access.queries 6343 articles. 1 followers. Follow

4 Replies
691 Views

Similar Articles

[PageSpeed] 7

Works fine for me with 2003 SP2.
You omitted a closing parenthesis.
-- 
KARL DEWEY
Build a little - Test a little


"mscertified" wrote:

> SELECT CDate((Month(RecordDate) & '/' & Day(RecordDate) & '/' & 
> Year(RecordDate)) AS RecDate
> 
> This converts 8/31/2007 to 8/1/2007
0
Utf
9/6/2007 3:30:06 PM
Where is the missing parentheses? I count 4 opening and 4 closing???

"KARL DEWEY" wrote:

> Works fine for me with 2003 SP2.
> You omitted a closing parenthesis.
> -- 
> KARL DEWEY
> Build a little - Test a little
> 
> 
> "mscertified" wrote:
> 
> > SELECT CDate((Month(RecordDate) & '/' & Day(RecordDate) & '/' & 
> > Year(RecordDate)) AS RecDate
> > 
> > This converts 8/31/2007 to 8/1/2007
0
Utf
9/6/2007 3:38:01 PM
What kind of data type is RecordDate?  If a text field, does RecordDate look 
like mm/dd/yyyy or dd/mm/yyyy?

Also why not just this assuming that the RecordDate field is text?
  CDate(RecordDate)

Please show some examples of the problem dates.
-- 
Jerry Whittle, Microsoft Access MVP 
Light. Strong. Cheap. Pick two. Keith Bontrager - Bicycle Builder.

"mscertified" wrote:

> SELECT CDate((Month(RecordDate) & '/' & Day(RecordDate) & '/' & 
> Year(RecordDate)) AS RecDate
> 
> This converts 8/31/2007 to 8/1/2007
0
Utf
9/6/2007 3:40:02 PM
IF RecordDate is a dateTime Field, I would use the DateSerial function.

SELECT DateSerial(Year(RecordDate), Month(RecordDate),Day(RecordDate))
FROM ...

What you posted seems as if it has one too many opening parentheses at the 
beginning of the calculated field and I would expect it to generate an 
error.
CDate((Month(RecordDate) & '/' & Day(RecordDate) & '/' &  Year(RecordDate)) 
AS RecDate
-- 
John Spencer
Access MVP 2002-2005, 2007
Center for Health Program Development and Management
University of Maryland Baltimore County
..

"mscertified" <rupert@tigerlily.com> wrote in message 
news:819D1570-97FC-4462-85E1-B45DA02ED45A@microsoft.com...
> SELECT CDate((Month(RecordDate) & '/' & Day(RecordDate) & '/' &
> Year(RecordDate)) AS RecDate
>
> This converts 8/31/2007 to 8/1/2007 


0
John
9/6/2007 4:20:16 PM
Reply:

Similar Artilces:

Hyperlinks to DB dont work now that DB is converted
We have converted all our Access 97 databases to Access 2000- not without a lot of issues. Most of them have now been researched and resolved, some re-coded, etc. We have one issue that we cannot resolve. We used to have hyperlinks on our Intra-net to several Access Databases. These were essentially "shortcuts" to the databases so that the general population could have easy access. Now that we did our Access conversion, the hyperlinks on our intranet do not work. Clicking on the link gives an option to open the file from its current location or download it to a local loc...

Send to Onenote on Windows 7, driver won't work?
I downloaded the driver from David Rasmussen, but every time I open OneNote after printing to XPS I get the message "Unhandled exception has occured in your application. If you click Continue, the application will ignore this error and attempt to continue. If you click Quit, the application will close immediately. Object reference not set to an instance of an object." If I click continue it still doesn't work. This was one of my favorite features - PLEASE PLEASE PLEASE find me a way to use OneNote! I lived off of it last year. Rilli wrote: > I downloaded the d...

Date Elimination
I have a worksheet with mainly dates in column A in the format of '25 Aug 2008'. Is it possible with a macro or similar to delete lines beyond a certain date (2 years hence)? Basically, I'm not interested in data more than 2 years old. This would eliminate a lot of data and make for a more viewable worksheet. try this Sub del_date() ActiveCell.Range("A1").Select Do Until ActiveCell.Value =3D "" dt =3D Date - 730 If ActiveCell.Value <=3D dt Then ActiveCell.ClearContents ActiveCell.Offset(1, 0).Select Else ActiveCell.Offset(1, 0).Select End If Loop End ...

auto caps don't work
in outlookk 2003, even tho i have set tools, options, spelling to autocorrect the first word of a sentence. it doesn't do it. i have never had this problem before, but now i have a new laptop and can't get this feature to work. -- tom martin Are you using Word as your editor? If so, your settings are there. Otherwise, learn to type. http://www.broderbund.com/jump.jsp?itemID=4713&itemType=CATEGORY&path=1%2C2%2C4713&ysmchn=GGL&ysmcpn=Typing&ysmcrn=sr2br29go633go202pi10ai50&ysmtrm=sr2br29go633go202pi10ai50+mavis+beacon&ysmtac=PPC&ovtac=PPC&SR=s...

USING DATES IN FORMULAS #2
I foubd a problem with excel 2003 If you introduce a formula using dates (in spanish version) (dd/mm/yy), excel doesnt makes the calculation........... ???? Can somebody hep me In the USA version (English), I could use: =if(a1=date(2005,10,27),"It's Oct 27, 2005","it's not") to refer to a date. I don't know what the Spanish function is for =date(), though. Carlos Benavides wrote: > > I foubd a problem with excel 2003 > If you introduce a formula using dates (in spanish version) (dd/mm/yy), > excel doesnt makes the calculation........... ????...

Search does not work for one workbook
I have workbook, but search (spotlight) often does not work for it. Drives me crazy. What can this be. I see peoples names in there. Kevs OS 10.6.2 INTEL imac Office 2004 Hi Kevs: It could be the file format the workbook is saved in. What extension does the file-name have? The extension tells the system what kind of data a file contains, which controls which importer Spotlight uses to read the file: if there is no extension you could get strange results. Cheers On 6/01/10 2:47 AM, in article C7689F21.5718F%forums55@verizon.net, "forums55@verizon.net"...

Pivot table
In the database we use SALES figures are listed per day. I would like to group them per week, per month in a pivot table. I've tried "Grouping", but get an error message. Who can point me in the right direction to get this done? -- digicat ------------------------------------------------------------------------ digicat's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=14920 View this thread: http://www.excelforum.com/showthread.php?threadid=499205 Hi Make sure that all of the data in the range are true Excel dates. Text values, or blank cells in...

How does hibernate work
I have a question on the details of how hibernate works. I know it's saving everything in memory to the hiber file. Since power seems to be truly off at hibernation I assumed the flag to tell the PC to resume from the hiber file rather than normal booting must be either saved on disk or flashed to a bit of bios rom space, or maybe in space maintained by the clock battery. But the cure for a laptop that is stuck in a loop of constantly resuming from hibernating is to unplug it and take the battery out for a while so where actually is the flag to signal the system that it's in hi...

working with temporary working files..
I keep getting the message that I cannot save a temp. working file. This work has been save on a cd and transfered back on to my desk top. Help ...

Conditional Format Tracker by Date
I'm building a tracker to make sure paperwork is done on time. Headers: A:Name B:IDNum C:Phone D:StartDate E:Plan F:Paperwork G:30DAuth H:90DAuth I'd like to use conditional formatting to compare the dates and color the cells for easier tracking. The compare TO date is column D. In column E, we have 7 days to write the plan so if there is no date in that column, turn red. When a date is entered turn green if within 7 days but yellow if it's past 7 days. In column F, same as column E but only 3 days for that one. (I can figure that out if I get a w...

Non-working work week
Is there any way to make an entire week a non-working work week? As in, a task is going to take 25 days, but the 4th of July occurs in the middle and you want to show that during that week (or 2), no work will occur. Besides creating a new task or extending the task during. Thanks in advance! Hi RVE, Open up the calendar, "Tools", 'Change working time..', then simply select the days you want as non working. Make sure that the calendar you change is the Project calendar and is the basis for all other calendars such as individual resource calendars. Hope thi...

Calculating date/time intervals??
I have multiple sets of date/time value combinations. For each start time (date/time) and finish time (date/time), I need a formula that calculates the number of days, hours, and minutes between the two events. Example: Start 5/14/2010, 11:25 Finish 5/17/2010, 18:30 Thanks for any assistance! John Hi, Assume that starting entry is in cell C7 and finishing entry is in cell C9 =INT(C9)-INT(C7) for days; =(C9-C7)*24*60 for minutes; and =(C9-C7)*24 for days -- Regards, Ashish Mathur Microsoft Excel MVP www.ashishmathur.com "jj" <jj@discussions.micr...

Graphing work and remaining work over time
I would like to generate a graph showing total actual work and remaining work for a top level task over time (week), This would enable me to show the projected remaining work through the duration of the project as it decreases from N to 0, and show the actual work completed though the duration of the project as it increases from 0 to N. The canned visual reports don't allow me to do this (that I can see anyway). Maybe I'm missing something. I also can't see how to customize a visual report that will do what I want. Using Microsoft Project 2007 (not the Server edit...

Excel 2000
Hello I am new and exhausted from trying to find an answer to m problem. I enter a date into a cell (ex. 020206 which should auto format t 02/02/2006) but when I hit enter I get a weird date that comes u 1/23/7436. This happens with any date I enter. I tried to custom format the cel ##/##/## but that doesn't work, and I tried "text to columns" but ha no success. Any help with detailed solutions would be appreciated. thank -- vt ----------------------------------------------------------------------- vtz's Profile: http://www.excelforum.com/member.php?action=getinfo&us...

GP8 Manufacturing
Hello Everybody. Our Shop works 5 days a week (closed weekends). We have a WC that works 6 days a week (down Sundays only). We have setup both the Shop and WC Calendars to reflect this reality. We would expect that, when scheduling an MO that routes thru this WC, the WC calendar will override the Shop Calendar? However, our tests are not showing this to be true - We use a Backwards Infinite Scheduling Method and it always skips the weekend when calculating the start day of an MO regardless of the WC. Does anyone have any experience working with the WC Calendars? Please share your wis...

outlook2003 send button does not work
send button does not work i have tryed a new email acc. and reinstalling with no luck. now i am useing express and then export to outlook ...

ISO SQL Date Format / ISO Date Formats
ISO date formats come in a number of variations, two such variations are YYYY-MM-DD and YYYYMMDD. The ISO SQL Standard date format is YYYY-MM-DD only which is termed a "date literal". According to the standard (see here: http://savage.net.au/SQL/sql-92.bnf.html#date literal) the "date literal" in order for it to be a "date literal" MUST be prefixed by the keyword DATE, if not then the text is simply nothing more than a "string literal" which has different meaning and subject to regional settings if used on data type conversions ie. st...

Drag and Drop does not work
Hi all. This is funny: When I try to drag and drop a message from "Inbox" to "Backup" I get an error message. When I right click and select "move to folder"- it does work. ANY CLUES? TIA Guy Not a single one. No Outlook version = no clues. -- Milly Staples [MVP - Outlook] Post all replies to the group to keep the discussion intact. All unsolicited mail sent to my personal account will be deleted without reading. After furious head scratching, Guy Cohen asked: | Hi all. | | This is funny: | When I try to drag and drop a message from "Inbox" ...

Internet Explorer E-mail links are no longer working in Outlook?
Hi, As soon as I click an e-mail link in Internet Explorer, another Outlook pops up. It used to just open a fresh new e-mail screen with the persons address already in the "TO:" line ? I can't figure out what I did wrong. Thanks, Rich ...

SunTrust Auto-Download Not Working after Banking Upgrade
I have been automatically downloading transactions from SunTrust since I installed MS$ 2007 Deluxe last year. I have done this without having to signup (for a fee of 5.95/month) with SunTrust for MS$ support. AFter the MS Banking Upgrade, I had to re-establish my SunTrust account with MS$. But, now I'm told (by MS$) that I don't have a SunTrust on-line account. Any thoughts? Anyone? I have been having issue as well with Suntrust, even if you get it to work you will find that its basically useless now downloading and duplicating pending transactions repeatedly, this is where I am ...

Spell check not working.
Version: 2004 Operating System: Mac OS X 10.6 (Snow Leopard) Processor: Intel I reinstalled SL and all my MS office apps and updates. I noticed that spell check does not detect spelling errors. Auto spell check is on and even when I manual invoke spell check it does not detect errors. <br><br>I see a progress bar at the word that is intentionally misspelled and the only dictionary that I see and it is check is a custom dictionary. <br><br>Should I reinstall Word? <br><br>Thanks in advance. No, reinstalling is not a fix on a Mac in the overwhelming m...

Working with option buttons in Word 2002
So, we are trying to create a form in Word 2002 in which we offer a series of radio or "option" buttons for some of our survey questions. However, we are struggling to make the option buttons work through the "Web Tools" toolbar. We can create the list we want to create, but can't save the file so it can be e-mailed and utilized in the correct capacity. Can someone please walk me through the steps of how to create a form in which there are numerous questions, almost all of which utilize the same clickable "option buttons" to choose either a &q...

Working with WORKS
We have some spreadsheets in WORKS 4.5 fpr Windows 95. But Excel 2000 won't open them. It says that the version is incompatible. How can that be if it is an older version of WORKS? Using Windows XP. -- ____________________ Bill DeShawn Please reply to group only Thank you http://my.sterling.net/~bdeshawn Generally you would normally open the file in WORKS and then save it down as a file that Excel can read. .xlr is a native Excel format, or .txt, .csv, dbaseIV are all formats it can read. You can also find a converter here if you don't have WORKS. http://www.rl-software.co...

Size of excel work book is not full screen
The excel work I have been sent is not full screen (about 3/4 size). Clicking on blue header does not make it full screen. It is not possble to stretch the window either. Maybe the workbook is protected with the windows option checked. Tools|Protection|unprotect workbook (if that option is available) You may need a password. Mike wrote: > > The excel work I have been sent is not full screen (about 3/4 size). Clicking > on blue header does not make it full screen. It is not possble to stretch the > window either. -- Dave Peterson ...

selected cells doesnot change colour
I want the excel cells to change colour as I select so I could see the range I have selected as it was in previous versions. How I can select this option. This is worksheet code so right-click the sheet tab and paste in Private Sub Worksheet_SelectionChange(ByVal Target As Range) Static lastcell As Range Target.Interior.ColorIndex = 3 'modify to suit lastcell.Interior.ColorIndex = xlColorIndexNone Set lastcell = Target End Sub Mike "Zarrar Janjua" wrote: > I want the excel cells to change colour as I select so I could see the range > I have selected as it was in ...