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!

Need Help using DateAdd() 1

Status
Not open for further replies.

jmskarp

Technical User
Aug 6, 2002
27
US
I have a Date field that has a numerical value stored in seconds. I want to convert this value using the dateadd() function, but I am receiving a compile error. Here is the code that I am putting into a query field:

DateAdd("s",[test],"31-Jan-70")
Note: the field test is another field in the query that contains the value, 1050088344.

MS Access version 2003 sp1.

Any help is greatly appreciated.

Thanks in advance.

Joel

/////////////////////////
Here is a formula that I got to work within Crystal Reports: DateAdd('s', {ticket.date_closed}, DateTime(1970, 01, 01, 00,00,10))
/////////////////////////




 
In the immediate window, I can see:

Code:
?DateAdd("s",1050088344,"31-Jan-70")
5/11/2003 7:12:24 PM

Is this what you wanted? If so, the problem is probably with your [Test] reference. you may need to set the recordset first, or just set it to an integer variable like:

Code:
dim intTest as Integer
intTest = [Test]
DateAdd("s",intTest,"31-Jan-70")

But you may still have to define the Recordset.

Sean.

 
perrymans,

Thanks for your quick reply. I will try your suggestion, but so far no luck....:-(

 
Wait a minute, this is in a query! Are you giving the new field a name? Like:

Date: DateAdd("s",[test],"31-Jan-70")

And test is the name of one of the query fields?

I plugged your DateAdd into a query and it works.

Sean.
 
Perrymans,

I did as you describe above.

Date: DateAdd("s",[test],"31-Jan-70")

The result that I receive is SUCCESS! I think that when adding the field from the query within the expression builder, that I clicked on the center column instead of the far right where the term "value" is located. I am not sure but that is the only thing that I can think of that I did differently this time.

You are AWESOME! You deserve a star...Have a good one..:)

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top