Forums
This topic is locked
Date Problem
13 Nov 2001 10:25:48 Yusuf A posted:
How do u insert into column the [date + 30 days] I tried numerous ways but failed to do sosSQL = ""
sSQL = sSQL & "INSERT INTO Items (ItemOwner, ItemTitle, CategoryID, ImageURL, AvailDate, CloseDate, Price, Quantity, Description ) "
sSQL = sSQL & " VALUES ( "
sSQL = sSQL & SQLVal(UserRS.Fields("ID") & ", "
sSQL = sSQL & SQLStr(vitemtitle) & ", "
sSQL = sSQL & SQLVal(vitemcat) & ", "
sSQL = sSQL & SQLStr(vitemurl) & ", "
sSQL = sSQL & SQLDate(GETDATE) & ", "
sSQL = sSQL GETDATE + 30 & ", "
sSQL = sSQL & SQLVal(vitemprice) & ", "
sSQL = sSQL & SQLVal(vitemquan) & ", "
sSQL = sSQL & SQLStr(vitemdesc) & " "
yConn.Execute(sSQL)
Please help!
Replies
Replied 13 Nov 2001 11:47:10
13 Nov 2001 11:47:10 Owen Eastwick replied:
Use something like:
CloseDate = DateAdd("d", 30, Now())
Even better don't insert these values at all but generate them within the table when the record is added:
Column Name - AvailDate
Data Type - datetime
Length - 8
Allow Nulls - Yes
Default Value - (getdate())
Column Name - CloseDate
Data Type - datetime
Length - 8
Allow Nulls - Yes
Default Value - (dateadd(day,30,getdate()))
Regards
Owen.
Multiple Parameter UD4 / Access 2000 Database Search Tutorial:
www.tdsf.co.uk/tdsfdemo
CloseDate = DateAdd("d", 30, Now())
Even better don't insert these values at all but generate them within the table when the record is added:
Column Name - AvailDate
Data Type - datetime
Length - 8
Allow Nulls - Yes
Default Value - (getdate())
Column Name - CloseDate
Data Type - datetime
Length - 8
Allow Nulls - Yes
Default Value - (dateadd(day,30,getdate()))
Regards
Owen.
Multiple Parameter UD4 / Access 2000 Database Search Tutorial:
www.tdsf.co.uk/tdsfdemo
Replied 13 Nov 2001 16:09:44
13 Nov 2001 16:09:44 Viktor Farcic replied:
I don't like using field in table when it's not necesary. Simply whenever you need to use CloseDate calculate it on directly on page (AvailDate + 30).
Edited by - vfarcic on 11/13/2001 16:11:38
Edited by - vfarcic on 11/13/2001 16:11:38