473,324 Members | 2,417 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,324 software developers and data experts.

Problems using Format & Cdate to convert text string to Date format

Hello, I've reviewed the archives here to address the issue, but I'm still running into problems. I've got a table field [CAS-ACC-OPEN-DATE] populated with the record date in text "YYYYMMDD"

To convert it into a recognizable date format, I've done the following:

Query 1: References Source Table; Isolates Year, Day; creates MMDD field
Acc Open Year: Left([CAS-ACC-OPEN-DATE],4)
Acc Open Day: Right([CAS-ACC-OPEN-DATE],2)
MMDD: Right([CAS-ACC-OPEN-DATE],4)

Query 2: References Query 1; Isolates Month
Acc Open Month: Left([MMDD],2)

Query 3: References Query 1 & 2; Concatenates Year, Month, Day, into MM/DD/YYYY
Acc Open Date: [Acc Open Month] & "/" & [Acc Open Day] & "/" & [Acc Open Year]

So now I have the date in MM/DD/YYYY format, but it's still stored as text. It needs to be in date format so I can do a calc to figure out how long an account has been open. I've tried nesting the expression in query 3 within Format-Cdate to convert it to a date format, but all it did was return errors in the table. See below:

ACC_OPEN_DATE: Format(CDate([ACC_OPEN_MONTH] & [ACC_OPEN_DAY] & [ACC_OPEN_YEAR]),"mm/dd/yyyy")

Can someone tell me what I'm doing wrong?
Mar 28 '07 #1
2 16741
Rabbit
12,516 Expert Mod 8TB
You forgot the "/"
Mar 28 '07 #2
MMcCarthy
14,534 Expert Mod 8TB
ACC_OPEN_DATE: Format(CDate([ACC_OPEN_MONTH] & "/" & [ACC_OPEN_DAY] & "/" & [ACC_OPEN_YEAR]),"mm/dd/yyyy")
Mar 29 '07 #3

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

Similar topics

10
by: Fawke101 | last post by:
Hi there, I have a date field in SQL server - that holds dates as DD/MM/YYYY format (GB). Now, i have an ASP application that Adds/Edits records in this table; and i am having real problems...
2
by: CDF | last post by:
In one of my tables, I have a field that has time durations in it. The field is currently in text format. Is there a way that I can convert this field into a format where I can SUM the durations? ...
5
by: deko | last post by:
After importing text date fields, the dates look like this: 12/31/2003 8:00:00 AM I'm having trouble working with these dates with Date(), Now(), etc, -- does not seem to match these dates....
15
by: Khurram | last post by:
I have a problem while inserting time value in the datetime Field. I want to Insert only time value in this format (08:15:39) into the SQL Date time Field. I tried to many ways, I can extract...
6
by: ransoma22 | last post by:
I developing an application that receive SMS from a connected GSM handphone, e.g Siemens M55, Nokia 6230,etc through the data cable. The application(VB.NET) will receive the SMS automatically,...
5
by: | last post by:
Can someone help me on a format problem. I am trying to do this.. format a string to a number. The string has a number with a colon in the middle. Format("1:30","00:00") returns 00:00 instead...
7
by: Richiep | last post by:
I am trying to get a UK format date of dd/mm/yyyy. Why does the following subroutine not return a valid date in a web form? The date returned is #12:00:00 AM# but the date I entered into the...
5
by: Takeadoe | last post by:
Gang - I'm generating date and time variables from scanned forms. Currently, the date and time values are as follows: 06/26/2006 and 11:30 AM. I've written VBA code to combine them into a...
8
by: Conan Kelly | last post by:
Crossposted: microsoft.public.dotnet.languages.vb microsoft.public.sqlserver.integrationsvcs Hello all, In XL 2003's VBA, I could use the format function to change "11SEP2008" (a string)...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
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...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
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...

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.