Turning A String Into Date

Sep 30, 2011

I am doing a project which currently requires me to input a new file we just got. However, the dates on all of them, as in the field containing the dates, displays something like 20030608 instead of June 8, 2003. I was thinking I could just run the file through a looped vb array to go through the information, reformat it, and then dump it into a new column.

View Replies


ADVERTISEMENT

Turning Query Results Into String...

Jun 23, 2005

Hello, I have a query that returns a list of courses undertaken by certain employees. They are in the format NPTC CS 30; NPTC CS 31; NPTC 33; NPTC FTC 38; NPTC FTC 40 etc...

Anyway what I need to do with this is convert these results to a string and manipulate them in such a way that they can be displayed in a text box on the back of an ID card in the following format:

NPTC CS 30, 31, 33, NPTC FTC 38, 40... etc.

Because there is not enough room on the back of the ID card to use a subform to just display them in a list...

View 3 Replies View Related

Converting A Text Date String To A Date For Calculations

Jan 7, 2005

Hi there. I'm just jumping into Access and have the following question. In my Purchase Order Table, I have a date field calcualated as text, i.e. "01/12/04". I need to convert this to a date format in my queries so I can do calculations, i.e. 01/12/04 - 01/05/04 = 7 days. Can someone help me with how to convert this text date to a date format. Sorry if this is an easy question. - AJS

View 4 Replies View Related

String To Date

Jan 16, 2007

I have just inherited a database that has dates stored as strings ex.: 01/01/01. I really do not have time to add a new field and convert the string date to date format (this would cause a lot of rewrite to the application that is using this table). I am trying to use the 'between' to display records that are between specific dates. Also, I am using Cold Fusion as the front end, if that makes any difference. Below is an example I thought might work but did not:

<cfquery name="acty_due_month" datasource="customer">
SELECT acty_end_dt
FROM activity
Where DateValue(Format([acty_end_dt], "MM/DD/YY"))=10/30/05
</cfquery>

Any assistance would be greatly appreciated.

View 9 Replies View Related

Convert String To Date

Mar 16, 2006

The dates in my table are strings that appear as 12305 (1/23/05) and so forth. So some are 5 and some are 6 digits depending on the 1 or 2 digit month. I want to convert them in my query to a date field. I think I have to use the DateSerial and extract the parts of the date, but that leading 0 that is not there is throwing me off. Any easy solutions?

View 2 Replies View Related

Modules & VBA :: How To Add A String To A Date

Feb 27, 2014

I want to add a string as year to a date.

Somehow it doesn't work out. It should extract all records with Valid_from = 01.01.2013 and valid_to = 31.12.2013. The Year assignment works.

Code:
Public Sub BEN()
Dim strSQL As String
Dim t As Date, s As Date
DoCmd.SetWarnings False
Year = Right(pricedate, 4)
t = 1 / 1 / " & Year & "
s = 12 / 31 / " & Year & "
strSQL = "SELECT TRANSFER_PRICES.* INTO [TEMP] " & _
" FROM TRANSFER_PRICES " & _
" Where [Valid_from] = " & Format(t, "#mm/dd/yyyy#") & _
" AND [Valid_to] = " & Format(s, "#mm/dd/yyyy#")
DoCmd.RunSQL strSQL
DoCmd.SetWarnings True
End Sub

View 3 Replies View Related

How To Convert Date To String

Aug 1, 2012

I am trying to create an order ID field based on the 1st 3 letters of the name of the buyer and the date of purchase. For example, if the buyer is James, I want the order ID to become JAM010112 (If the date is 01/01/12). How do I go about doing this?

View 1 Replies View Related

Another String To Date Conversion Problem

Oct 6, 2006

I have a table with a text field to receive dates or "na" or "n/a". From this, I am trying to run a query that selects all dates that are not "na" and not "n/a" and not null. This works fine with a criteria of

"Is Not Null And Not In ("NA","N/A")"

The problem is, I also must select a date range. In the query, I have created a calculated field equal to various date conversion functions and they all seem to work at converting the text to date. However, I get a Type Mismatch error any time I try to do anything to the date field such as select a date range or to sort on it.

Any suggestions?

View 4 Replies View Related

Please Help! Compare Weird Date String

Nov 8, 2007

Hi all,

I currently have two strings that look like this 070707 and 020709. What i need to do is compare these two dates and see which one is greater.
Is there any easy way to do this since the year is just yy instead of yyyy?

Thanks in advance

View 2 Replies View Related

Convert String To Date - Please Help Newbie

Nov 17, 2004

Hihi

I have a field containing data in this format
01Apr04:12:34:56
for example

It is not recognized as a date by Access, so it is stored as text

I need to put it in any general date/time format, like
dd/mm/yy hh:nn:ss
I also need that Access actually reads it as a date/time (not a string) to be able to merge with other data, then sort chronogically.

How can I do that (please no code, only query if possible, i'm really a newbie...)

thx!

caroline

View 1 Replies View Related

Queries :: Convert String To Date?

Oct 15, 2013

In my query I want to extract the last 10 characters of a string in a column which represent a date in the format DD.MM.YY and then convert these to a real date format to be available for further processing.

My query looks like this:

SELECT Angebotskopf.[Laufende Nummer], Angebotskopf.Angebotsnummer, Angebotskopf.Angebotsdatum, Angebotskopf.Anfragedatum, Angebotskopf.Kunde, Angebotskopf.Ansprechpartner, Angebotskopf.Telefonnummer, Angebotskopf.Faxnummer, Angebotskopf.Projekt, Angebotskopf.Preis, CONVERT(varchar(10), RIGHT(Angebotskopf.Projekt, 8),104) AS TestAngebot
FROM Angebotskopf;

But Access gives an error message "unknown function 'CONVERT'"

The "RIGHT" functions works but the resulting column is not being recognized as a date, it is a only a string and therefore useless for processing of any date related calculation.

View 3 Replies View Related

Convert String To Date In Query

Jun 21, 2015

I have a string value that comes out of a query in the form of

01012015
02012015
12012014

etc...

where the first 2 digits are the month, the next 2 are the day, and the next 4 are the year.How do I convert these values to a valid date that can be queried on?

View 14 Replies View Related

Formatting A Date In A String Also Including Text

Feb 2, 2006

Hi there,

I have to format a date following dd-mmm-yy in an expression also containing text.

Expr1: "Text" & " " Date()

Although separately formatting the date is easily done. I need to keep both int he same expression.

View 3 Replies View Related

Empty String In Date/time Datatype

Apr 23, 2007

There is a end_date column record with date/time datatype, how could i query datat that showing the particular is empty.

I try end_date = NULL, no record is showing and end_date = ' ' , datatype mismatch... so which one should i write?

View 3 Replies View Related

Convert String To Date Problem In SQL Statement.

Apr 27, 2007

In the following statement i tried to send BeginningDate(textbox value) and

EndingDate(txtbox value) to the SQL stmnt but it gave an error saying "Type

Mismatch" even though i used CDate method. answer for this problem is greatly

appreciated......

"WHERE Project.tProjTitle='" + Trim(cboProjectTitle) + "' AND

Project.nProjId=Indicator.nProjId AND Indicator.tIndicatorName='" +

cboIndicator + "' AND Indicator.nIndicatorId=IndicatorData.nIndicatorId AND

Region.nRegionId=IndicatorData.nRegionId AND

Institute.nInstituteId=IndicatorData.nInstituteId AND" + _
"IndicatorData.indicDate Between '" + CDate(BeginningDate) +

"' AND '" + CDate(EndingDate) + "' " + _"GROUP BY

IndicatorData.nRegionId, " + Trim(Replace(cboRows, "_", ".")) + " "

View 2 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

Modules & VBA :: Inset Date Add Code To SQL String

May 22, 2015

I am trying to add 30 or 45 days to a certain date and insert that date in a table. The field is declared as datetime on the SQLServer and has been tried with all date formats, and none, on the access side.The problem I am encountering is that the date is being inserted as 12:00:00 in the table, no date is being stored.When I print out the SQL statement to the immediate window, the date in question shows the correct date.

Code:

Dim a As Date
Dim b As Date
a = DateAdd("d", 45, Me.DateOfExit)
b = DateAdd("d", 30, Me.DateOfExit)
strSQL = "INSERT INTO MyTable ( No, Name,DueDate, OriginatedBy, ID, Status) " & vbCrLf & _
"VALUES (" & Me.No & ",'" & Me.Name & "', " & b & ", '" & Me.Facilitator & "', " & Me.ID & ", '" & "Required" & "');"

I have tried adding the date add code to the SQL string, but that produced the same result.

View 4 Replies View Related

Queries :: Can't Evaluate Date In Text String

Apr 17, 2014

I'm working with a table of financial transactions. I need to know the date a record relating to cash received actually arrived in our bank, but the software doesn't allow the user to enter this, so I've asked them to enter it into a text reference field, e.g. 'Other Text XX 16/04/14', and then I've got a formula - CDate(Right(Trim([RefField]),8)) - which takes the date from this reference.

This works fine, but it's really important I don't miss any of these records due to the date not being entered, so what I'm trying to make is a formula which will give me the date from the ref field as in the formula above if there is one, but if that formula gives an error (so the date has been missed out or incorrectly entered) then I want to take the date from another field, called [DateAdded] as a failsafe.

I can't work out a formula that won't give me an error, i've tried loads. First I tried :

iif(iserror(CDate(Right(Trim([RefField]),8))),[DateAdded],CDate(Right(Trim([RefField]),8)))

But that gives an error, and I think from looking at forums that Access evaluates both parts of an Iif function so it'll do that.

It seems like other people are saying that you need to use Nz, IsDate or IsNumeric or something along those lines instead of IsError to evaluate the field, but I can't get that to work as it's not a field, it's a portion of a text field.

This is my latest attempt:

Join Date: IIf(IsDate(Right(Trim([RefField]),8)),[DateAdded],[Calc Date]),

where [Calc Date] is an expression field with CDate(Right(Trim([RefField]),8)) in it, but there's the #Error again.

How can I use iif to pick either a date from a text string, or where that results in an error then another date field?

View 9 Replies View Related

Modules & VBA :: Getting A String With Month / Year From A Date

Apr 7, 2015

I need to use VBA to get a string which is essentially just a month and year (so date, not including day)

Would Prefer it to be 04/15 as opposed to April-15, as the number is easier to sort than the word (how to sort month names in numerical order as opposed to alphabetical id).

So that I assume i could do by =format(now(), mm/yy) (though havent actually tested it)

However to add to the complexity id also need to add a month to it, so for instance todays date is 08/04/15, id need the string to read "05/15"

or if the date was 10/12/15 id need the string to read "01/16"

View 3 Replies View Related

Turning A Db Into A Webpage.

Nov 3, 2006

Hi,

Is there a good developer tool for turning an access db into a webpage?

Or should I go about it in a completely different way?

I want it to work just as it does, but I would like to have it on the www.

Fuga.

View 11 Replies View Related

Modules & VBA :: How To Prevent Access Change String To Date

Dec 23, 2014

I wrote a VBA code to get the field value of a csv file, then use it to update the database table. I paste some of my code below

Dim objConn As New ADODB.Connection
Dim objRs As New ADODB.Recordset
Dim objUpdate As ADODB.Connection

objConn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & theFolderName & ";Extended Properties='text;HDR=Yes;FMT=Delimited'"

[Code] ....

1. The target of this code is to set the [Section] value in the table
2. The [Section] value is at the 3rd column inside the csv file
3. By using the UPDATE query, it map the [Section] value to the corresponding [Program] and [Course] in the table

This code did the job. But the problem is the string of the [Section] value is like "2-22-01". But after update to the table, the value become "2/22/2001".

The value is a string text, not date. How can I prevent this happen ?

I just attached 2 files, 1 mdb and 1 txt (change the extension to csv before test).

View 3 Replies View Related

General :: Convert Text String To Date Format

Apr 10, 2013

I am connecting acces to oracle servers via ODBC .

In the table there is a date time stamp - format data type text:

20130225060621

I would like to convert so that it is recognised as a date so I can calculate against e.g. Now() or another standard date format.

this is what I am currently using (which is OK) BUT I need to calculate against the time also.

Current Check Point Date: CDate(Mid([DZ_ZPKT_AK],7,2) & "/" & Mid([DZ_ZPKT_AK],5,2) & "/" & Mid([DZ_ZPKT_AK],1,4))

I spoke to an IT guy who works in TOAD program and he gave me this SQL:

select to_date(dz_zpkt_ak,'DD/MM/YYYY HH24:MI:SS')from orders where ordnr='4411310';

this is the format I would like but cant make this work.

View 12 Replies View Related

Turning Off Spell Check?

Aug 25, 2006

We need to enter the string INCL as a data value in one of our tables. When we try to exit the field, Access keeps changing it to INCLUDE. This occurs whether the value is entered via a form or directly in the table. I assume it is doing some type of autocorrect based on th spelling. There is no VBA code associated with this field.

Is there some way to turn this off?

View 2 Replies View Related

Turning A Cell Red In A Query?

Sep 28, 2011

I would like to turn a cell red in a query - is this possible or can this only be done in a form or report. I have created a table with medical information and want the cell to turn red when blood pressure entry is greater than 140. Not sure what and where formula should be entered.

View 3 Replies View Related

Turning The Records In A Table Sideways

Mar 27, 2007

I have a table with data structured like this:

Emp#STOT
--------------------
301741421540
301801882518
3020024000
30223227166

I want to create a query that takes that data and does this:


Emp#STOT
--------------------
3017414210
301740540
3018018820
301800518
3020024000
3020000
3022322710
30223066

Is that even possible? How do I get started?

View 6 Replies View Related

Turning Current Fields Into Autonumber

Jun 26, 2007

Hi all.

I have been tasked with replacing an external database in house and obviously the external database has multilpe tables joined by various id fields. I'm assuming when they created the db they were assigned autonumber qualities etc to create unique numbers.

However, I can't replicate that in mine. I have the external references for existing data fine. But ho do I now create a new record with a unique number in the existing field.

I tried setting it to primary key and/or no duplicates etc but it's expecting me to enter a number.

I imagine I've got to set some kind of loop to count from one and matech it and then when it finds a number not currently in use it'll stop and use that but how to do that........

Cheers for any help.

View 2 Replies View Related







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