-
Mar 28th, 2015, 02:49 PM
#1
Thread Starter
Enjoy the moment
[RESOLVED] Update Field Daily Routine forgot how
i want to update a date field every day that passes but i forgot how
do i need to use Cdate or Date Add?
e.x if today is 28-03-2015 then i will update the field to 29-03-2015
and so on
Code:
StrSql = "Update SendZTotalToCelular Set Zdate = " ' Here i need to make the update
CN.Execute StrSql
tnx for any help
salsa31
-
Mar 28th, 2015, 02:52 PM
#2
Re: Update Field Daily Routine forgot how
If zDate is a date field, and since this is Access, I think you can use a couple of choices:
Zdate = DateAdd("d", 1, Zdate)
Zdate = Zdate + 1
IF ZDdate is a text field, you'll likely need to convert ZDate using CDate() before adding to it, then convert the result back to string to store in the database field
-
Mar 28th, 2015, 02:54 PM
#3
Thread Starter
Enjoy the moment
Re: Update Field Daily Routine forgot how
hey lavolpe the field is a Date / time
dont i need a variable for the Zdate?
dim Zdate as Date?
-
Mar 28th, 2015, 02:56 PM
#4
Re: Update Field Daily Routine forgot how
Zdate is also the name of the field? If so, does this statement work for you?
Code:
"Update SendZTotalToCelular Set Zdate = Zdate + 1"
-
Mar 28th, 2015, 03:02 PM
#5
Thread Starter
Enjoy the moment
Re: Update Field Daily Routine forgot how
tnk you very much sir
-
Mar 29th, 2015, 01:55 PM
#6
Re: [RESOLVED] Update Field Daily Routine forgot how
Using the date +1 does not sound like the right approach to me here. If I am understanding correctly what you want is today's date. If that be the case then using date +1 can lead to corrupted data and a headache down the line. If the program is always running or runs every day then date +1 would work out to give today's date but if for some reason there is a day that the program is not ran the date would be off by one or more days and would be off on every day that follows over time it could be off my several days or even weeks.
Sounds like you need to use the actual date rather than adding to what is there already
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|