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!

how can ?I get the current date

Status
Not open for further replies.

jsnunez

MIS
Feb 4, 2004
72
US
Hi

How can I get the current date in an adp project

Format(Date, "yymmdd") does not work

jsn
 
Are you getting an error or is it just returning the wrong value. If you are getting an error, check your references for a missing reference.. I use the Date() function in my adp with out a problem.

Hope this helps.

OnTheFly
 
In what context are you refering? Is this in a text box on a form, as a default value? In a query? In a report?

Hope this helps.

OnTheFly
 
In a form

I am trying to populate a key field with the date and time values.

 
Is this on new records or existing records? Is the control bound to a field that you are populating? Where are you putting the Format(Date, "yymmdd")?

Sorry for all the questions but it is hard to give you options when it is not clear exactly what is being done.

Hope this helps.

OnTheFly
 
In access create a module such as:
Public Function getCurrentDayHour() As String
Dim strQuery As String, rsResult As ADODB.Recordset



strQuery = "dbo.spCurrentDateTime"
Set rsResult = CurrentProject.Connection.Execute(strQuery)
getCurrentDayHour = Mid(rsResult("CurrentDateTime"), 3)


End Function


In SQL Server, create a store procudure with:

Create procedure dbo.spCurrentDateTime
as

select GETDATE() as CurrentDateTime



It Works!!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top