Update strSQL with input box

Posted on 2013-10-21
Medium Priority
Last Modified: 2013-10-21

I am using the code below to add X number of days to a [DueDate].  I want to make it more dynamic and i/o having numerous buttons on the report for Adding 1 Day, 2 Days, 3 Days to the [DueDate] I would rather have an input box.  I thought I could add the bolded areas below i/o having a hard coded number.

I get an error with the below.  
How can I do what I am proposing?  

thank you
        Dim strSQL As String
               strSQL = "UPDATE TASKS Set DueDate = DateAdd('d', [Enter Days to Add], DueDate) WHERE  status <> 'Completed' AND DueDate= Date() [Enter How Many Days Ago]"
           CurrentDb.Execute strSQL, dbFailOnError
Question by:pdvsa
  • 2
LVL 61

Accepted Solution

mbizup earned 2000 total points
ID: 39587579
Try this:

strSQL = "UPDATE TASKS Set DueDate = DateAdd('d', " &  Inputbox("[Enter Days to Add]") & ", DueDate) WHERE  status <> 'Completed' AND DueDate= Date() - " & inputbox(" [Enter How Many Days Ago]")

Open in new window


Author Closing Comment

ID: 39587618
nice!  worked perfectly.  I see what you did.  Got a little techy on me.  haha
LVL 61

Expert Comment

ID: 39587623
<<I see what you did.>>

Good!  ;-)

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Microsoft Access has a limit of 255 columns in a single table; SQL Server allows tables with over 255 columns, but reading that data is not necessarily simple.  The final solution for this task involved creating a custom text parser and then reading…
When we develop an application in Ms Access 2016 we should also try to protect the queries, macros and table links. I know I may not have a permanent solution but for novice users, they will not manage to break your application. Below is the detail …
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …
Enter Foreign and Special Characters Enter characters you can't find on a keyboard using its ASCII code ... and learn how to make a handy reference for yourself using Excel ~ Use these codes in any Windows application! ... whether it is a Micr…

624 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question