Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Queries / November 2007

Tip: Looking for answers? Try searching our database.

subtract days from a date

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
sheniece - 12 Nov 2007 00:14 GMT
Ok. I have a form with a text box and button,  the textbox take a text value
which represents the number of day.  I have a table and one of the columns is
named DateCreated,    I would like to take the number entered in the text box
and  subtract it from a short date in a query, and return all records that
were created n days ago, currently i have this in the criteria column of the
query.

=< -10

I thought this would return all records created 10 days ago.  Do i have to
convert the value i recieved in the textbox to date format.
sheniece - 12 Nov 2007 00:53 GMT
Ok. I figured it out.

>=DateAdd("d",-([Forms]![frmName]![tbxDays]),Date())

>Ok. I have a form with a text box and button,  the textbox take a text value
>which represents the number of day.  I have a table and one of the columns is
[quoted text clipped - 7 lines]
>I thought this would return all records created 10 days ago.  Do i have to
>convert the value i recieved in the textbox to date format.
Marshall Barton - 12 Nov 2007 01:10 GMT
>Ok. I have a form with a text box and button,  the textbox take a text value
>which represents the number of day.  I have a table and one of the columns is
[quoted text clipped - 7 lines]
>I thought this would return all records created 10 days ago.  Do i have to
>convert the value i recieved in the textbox to date format.

Comparuing a date value to a number is meaningless.  Use the
date manipulation function to operate on date values:

    <= DateAdd("d", -Forms!theform.thetextbox, theshortdate)

Signature

Marsh
MVP [MS Access]

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.