Hello,
I have to find the difference between two date fields. I have a system date which I have defined as Date in my form. I also have a Date Modified field. I want to subtract the Date Field from the date Modified field and get a total days variable. I will use this Total Days variable in an If Statement to determine whether other fields can be changed or not. I do not want any field changed after five days on the form. If the the TotalDays variable equals 5, I will not let any changes be saved. If the TotalDays is less than five, I will let changes be made to fields.
Is there a way in VB to do this?
agreenvbman
|
Invasive contributor
|
![]() |
| 23Aug2009,03:21 | #2 |
|
you should get the result by a direct subtract statement
Did you already tried it? |
|
Newbie Member
|
|
| 29Aug2009,18:57 | #3 |
|
I am trying to use a Sequel Server 2005 database table called CallIssueMain to find the records with DateTimeAdded less than 6 days.
I am trying to write the Tsequel coding like this, but getting an error. What is wrong with my coding inside the Query window? The Coding: Declare @EndDate smalldatetime, @StartDate smalldatetime set @StartDate = dateadd(dd,-6,getdate()) set @EndDate = getdate() Select ID, Issue, Resolution, DateTimeAdded,FROM CallIssueMainWHERE User= @UserName and Date between @StartDate and @EndDate The error I get is: ERROR PARSING QUERY.[TOKEN LINE NUMBER = 1, TOKEN LINE OFFSET = 1, TOKEN IN ERROR = DECLARE] ERROR SOURCE: ADO.NET DATA PROVIDER |
|
Invasive contributor
|
![]() |
| 29Aug2009,20:01 | #4 |
|
Looks like its the problem in the Declare statement
TOKEN IN ERROR = DECLARE Check if this helps: http://www.experts-exchange.com/Prog..._24479076.html |
|
Go4Expert Founder
|
![]() |
| 30Aug2009,08:46 | #5 |
|
experts-exchange.com will not allow to see the answer unless you are an expert member or paid member.
|
|
Invasive contributor
|
![]() |
| 30Aug2009,19:48 | #6 |
|
Quote:
Originally Posted by shabbir but today after your reply I found something which I didn't noticed earlier If you go to expert-exchange from google it shows you the answer at the bottom of the page, but if you go directly, then it doesn't check the attached page which I got after googling ![]() till now even I was in question whether they have changed the policy or is it just me than I can see the answers. it might be only 2-3 times that I was unable to see the answer, but most of the time I did see. I think google is the reason
|
|
Go4Expert Founder
|
![]() |
| 30Aug2009,22:03 | #7 |
|
I never scrolled that down but yes may be may be not. Who cares. I believe in information and knowledge should be open to all.
|




