Hi.
I need help in resolving my query.
I want to update my target date based on it's raise date.
but I want to set my target date based on my task severity [i.e.Minor(15 days period), Medium(60 days period), Major(120 days period)].
So for that I have written one syntax, but it was not working.
can anyone help me out? - Private Sub ECR_RAISE_DATE_AfterUpdate()
-
If Not IsNull(Me.ECR_RAISE_DATE) Then
-
Me.ECR_TARGET_DATE = Me.ECR_RAISE_DATE + 15
-
End If
-
If Me.CATAGORY = "MEDIUM" Then
-
Me.ECR_TARGET_DATE = Me.ECR_RAISE_DATE + 60
-
End If
-
If Me.CATAGORY = "Major" Then
-
Me.ECR_TARGET_DATE = Me.ECR_RAISE_DATE + 120
-
End If
-
End Sub
Hi Karnav.
If you would like help with a problem then it makes sense to explain what the problem is first. Saying something doesn't work without including any details is something we unfortunately see a lot of. I'm not sure why it isn't obvious to everyone but that's like a police despatcher getting an emergency call and being told there's a problem, just before the caller hangs up. It's hard to help with a problem without any clues as to what the problem is.
From what I can see the code looks workable. Category is mis-spelled, but I suspect that's also true of the Control on the form so they should match anyway. The code could be written more clearly and concisely, as I've shown below, but that doesn't mean your current code shouldn't work.
Perhaps with more in the way of what went wrong and where we could be of greater help. - Private Sub ECR_RAISE_DATE_AfterUpdate()
-
With Me
-
If IsNull(.ECR_RAISE_DATE) Then Exit Sub
-
.ECR_TARGET_DATE = DateAdd("d", Switch(.Category = "Major", 120 _
-
, .Category = "Medium", 60 _
-
, True, 15), .ECR_RAISE_DATE)
-
End With
-
End Sub
2 737
Two points.
1) Have a look at the DateAdd Function. If you think about it, ECR_RAISE_DATE is a date time field, so does ECR_RAISE_DATE + 15 mean add 15 seconds, 15 hours, 15 days, 15 years or what?
2) On the MEDIUM Category, before the End If add
That way if the category is MEDIUM, you won't wast effort checking if it is MAJOR.
Phil
NeoPa 32,556
Expert Mod 16PB
Hi Karnav.
If you would like help with a problem then it makes sense to explain what the problem is first. Saying something doesn't work without including any details is something we unfortunately see a lot of. I'm not sure why it isn't obvious to everyone but that's like a police despatcher getting an emergency call and being told there's a problem, just before the caller hangs up. It's hard to help with a problem without any clues as to what the problem is.
From what I can see the code looks workable. Category is mis-spelled, but I suspect that's also true of the Control on the form so they should match anyway. The code could be written more clearly and concisely, as I've shown below, but that doesn't mean your current code shouldn't work.
Perhaps with more in the way of what went wrong and where we could be of greater help. - Private Sub ECR_RAISE_DATE_AfterUpdate()
-
With Me
-
If IsNull(.ECR_RAISE_DATE) Then Exit Sub
-
.ECR_TARGET_DATE = DateAdd("d", Switch(.Category = "Major", 120 _
-
, .Category = "Medium", 60 _
-
, True, 15), .ECR_RAISE_DATE)
-
End With
-
End Sub
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Scott |
last post by:
In the result of a SELECT statement, how can you change cell values
from NULL to BLANK?
The following does NOT do it:
SET fieldname = ' '
WHERE fieldname IS NULL
Also, for colums with a DATE...
|
by: adrianca |
last post by:
Hi All,
If have a sql table with 2 columns and 2 rows with values
,].
Using t-SQL with "for xml"
How can i create a xml where the cell values (not column names) appear
as elements?
eg:...
|
by: Richard Dixson |
last post by:
Under ASP.NET (C#) I want to create a page that people can use to submit
questions. This page will consist of a table with several rows of
information, like:
Name: Bill Smith
Job title:...
|
by: Richard Dixson |
last post by:
Under ASP.NET (C#) I want to create a page that people can use to submit
questions. This page will consist of a table with several rows of
information, like:
Name: Bill Smith
Job title:...
|
by: Materialised |
last post by:
Hi All
I have been searching the net on this for the last couple of hours to no
avail.
I need to fill a datagridview control based on the values entered in 2 text
boxes.
However I cant for...
|
by: jeganwaran |
last post by:
retrieve cell values from the grid view using code
|
by: RKT |
last post by:
I have a DataGridView bound to an MS Access table. This is a single-
user application. When the User is adding or editing a row, the User
may click on a Control elsewhere. That Control has context...
|
by: convexcube |
last post by:
To keep a record of training levels for different tasks, I have 18 option groups with 4 options values each: 0 labelled as "None", 1 labelled as "Trainee", 2 labelled as "Competent" and 3 labelled as...
|
by: silentbuddha |
last post by:
Hi, I am currently having some difficulties with this sunroutine that I created. My 2 dimensional array is empty.
- This code is within my UserForm1
- this sub is suppose to first select the...
|
by: Miranda Truehill |
last post by:
I'm very new to programming and although I've seen a similar post that addressed this in part, I am unsure how exactly to go about this. I know I can utilize the DateAdd function but don't know...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
| |