By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,456 Members | 1,400 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,456 IT Pros & Developers. It's quick & easy.

Want to add a month

P: 4
Hi to all,

I want the solution for the below said problem in which I want to add month to the formated date field.

format(dttTerminationDate," & "'" & "mmmm-yyyy" & "'" & ")

where dttterminationdate is the date field & i have changed it to the format of "mmmm-yyyy"

Kindly give the solution

Thanks in advance

Renuka
Nov 6 '08 #1
Share this Question
Share on Google+
6 Replies


DonRayner
Expert 100+
P: 489
Hi to all,

I want the solution for the below said problem in which I want to add month to the formated date field.

format(dttTerminationDate," & "'" & "mmmm-yyyy" & "'" & ")

where dttterminationdate is the date field & i have changed it to the format of "mmmm-yyyy"

Kindly give the solution

Thanks in advance

Renuka
Try this

Expand|Select|Wrap|Line Numbers
  1. DateAdd("m",1,(format(dttTerminationDate," & "'" & "mmmm-yyyy" & "'" & "))
  2.  
Nov 6 '08 #2

missinglinq
Expert 2.5K+
P: 3,532
format(dttTerminationDate," & "'" & "mmmm-yyyy" & "'" & ")
I'm totally at a loss as to what you're trying to accomplish with all the ampersands and quotation marks, but I assume you're trying to add a month to

dttTerminationDate

and display it in the format of

November-2008

When doing this kind of thing you use the DateAdd() function using the actual date field, then format the results; you don't format the date and then add to it. This should do what you're after:

Format(DateAdd("m",1,dttTerminationDate),"mmmm-yyyy")

Welcome to bytes!

Linq ;0)>
Nov 6 '08 #3

P: 4
Try this

Expand|Select|Wrap|Line Numbers
  1. DateAdd("m",1,(format(dttTerminationDate," & "'" & "mmmm-yyyy" & "'" & "))
  2.  

Thanks & I will check & revert back to you soon


Renuka
Nov 7 '08 #4

P: 4
I'm totally at a loss as to what you're trying to accomplish with all the ampersands and quotation marks, but I assume you're trying to add a month to

dttTerminationDate

and display it in the format of

November-2008

When doing this kind of thing you use the DateAdd() function using the actual date field, then format the results; you don't format the date and then add to it. This should do what you're after:

Format(DateAdd("m",1,dttTerminationDate),"mmmm-yyyy")

Welcome to bytes!

Linq ;0)>


Thanks & I will check & revert back to you soon


Renuka
Nov 7 '08 #5

P: 4
Hi,

strSql = "select vchReferenceValue,vchEmployeeFirstName,vchFHGName, dttTerminationDate,"
strSql = strSql & " vchReasonForLeaving,numCompensationAmount"
strSql = strSql & " from tbmastemployee,tbmastemployeedeductionreference ,tbmastdeduction where "
strSql = strSql & "tbmastemployeedeductionreference.intrefemploy eeid = tbmastemployee.intEmployeeId "
strSql = strSql & "and tbmastdeduction.intdeductionid=tbmastemployeededuc tionreference.intrefdeductionid and tbmastemployeedeductionreference.chractivestatus=' Y' and "
strSql = strSql & " tbmastdeduction.intdeductionid=" & gintPFID & " and format(dttTerminationDate," & "'" & "mmmm-yyyy" & "'" & ")= Format(#" & mstrdate & "#, " & "'" & "MMMM-yyyy" & "'" & " )"



when i give the format DateAdd("m",1,(format(dttTerminationDate," & "'" & "mmmm-yyyy" & "'" & "))

then it is throwing the error as Expected:end of statement kindly give me the solution for this problem

Renuka
Nov 7 '08 #6

DonRayner
Expert 100+
P: 489
Hi,

strSql = "select vchReferenceValue,vchEmployeeFirstName,vchFHGName, dttTerminationDate,"
strSql = strSql & " vchReasonForLeaving,numCompensationAmount"
strSql = strSql & " from tbmastemployee,tbmastemployeedeductionreference ,tbmastdeduction where "
strSql = strSql & "tbmastemployeedeductionreference.intrefemploy eeid = tbmastemployee.intEmployeeId "
strSql = strSql & "and tbmastdeduction.intdeductionid=tbmastemployeededuc tionreference.intrefdeductionid and tbmastemployeedeductionreference.chractivestatus=' Y' and "
strSql = strSql & " tbmastdeduction.intdeductionid=" & gintPFID & " and format(dttTerminationDate," & "'" & "mmmm-yyyy" & "'" & ")= Format(#" & mstrdate & "#, " & "'" & "MMMM-yyyy" & "'" & " )"



when i give the format DateAdd("m",1,(format(dttTerminationDate," & "'" & "mmmm-yyyy" & "'" & "))

then it is throwing the error as Expected:end of statement kindly give me the solution for this problem

Renuka
You have 3 opening brackets and only 2 closing brackets, just add one more closing bracket to the end of your statement.
Nov 7 '08 #7

Post your reply

Sign in to post your reply or Sign up for a free account.