Hi everyone!!
I have a continuous form that allows users to select a record and chnage the DATE that the record is assigned to another DATE within the same year. The button is called "Change plan Date Within 2008." The user can select a particular record, click that button and a new small form appears that displays the current Plan Date and a textbox for entering a new Plan Date. - 'If the New Plan Date is earlier than today's date, this is not allowed
-
If DateDiff("d", Date, NDate) < 0 Then
-
MsgBox "You can not enter a Plan Date earlier than today's date."
-
Exit Sub
-
End If
I want to make it to where when the user clicks on a record and then clicks that button and types in a new Plan Date and clicks OK, that it won't allow the user to type in a Plan Date that is EARLIER than the one already assigned to that record.
here's my code on that command, but so far it doesn't seem to be working like it should. - Private Sub cmdOK_Click()
-
Dim NDate As String
-
Dim oDate As String
-
-
'Check to see if there is anything typed into the New Plan Date field, if not, close the form
-
NewPlanDate.SetFocus
-
-
If NewPlanDate.Text = "" Then
-
DoCmd.Close acForm, "frmPlanChangeDate"
-
Exit Sub
-
End If
-
-
oDate = OldPlanDate.value
-
NDate = NewPlanDate.value
-
-
'If the New Plan Date is earlier than today's date, this is not allowed
-
If DateDiff("d", Date, NDate) < 0 Then
-
MsgBox "You can not enter a Plan Date earlier than today's date."
-
Exit Sub
-
End If
-
-
'If the user tries to change the year in this form, this is not allowed
-
If Year(oDate) <> Year(NDate) Then
-
MsgBox "You can not change the year of the Plan Date here." & vbCrLf & "Please use the " & """" & "Move To" & """" & " buttons to change years."
-
DoCmd.Close acForm, "frmPlanChangeDate"
-
Exit Sub
-
End If
-
-
'Figure out the year and set the Plan Date appropriatly
-
-
Forms!frmPlan!frmPlanList.Controls("PlanDate").value = NDate
-
-
'Close the form
-
DoCmd.Close acForm, "frmPlanChangeDate"
-
-
End Sub
4 1939
Nevermind I figured it out! - 'If the New Plan Date is earlier than today's date, this is not allowed
-
If DateDiff("d", Date, NDate) < 0 Or DateDiff("m", Date, NDate) Then
-
MsgBox "You cannot enter a Plan Date earlier than today's date."
-
Exit Sub
-
End If
wait i may have spoke too soon.... it's still not workin...
Nevermind I figured it out! - 'If the New Plan Date is earlier than today's date, this is not allowed
-
If DateDiff("d", Date, NDate) < 0 Or DateDiff("m", Date, NDate) Then
-
MsgBox "You cannot enter a Plan Date earlier than today's date."
-
Exit Sub
-
End If
OK I did figure it out!
Simple change - 'If the New Plan Date is earlier than the old date, this is not allowed
-
If DateDiff("d", oDate, NDate) < 0 Then
-
MsgBox "You cannot enter a Plan Date earlier than the old date date."
-
Exit Sub
-
End If
[/quote]
Actually, with dates, a simple If Date1 < Date2 Then works just fine!
Linq ;0)> Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Gleep |
last post by:
Hey Guys,
I've got a table called Outcomes. With 3 columns and 15 rows
1st col 2nd col 3rdcol
outcome date price
There are 15 rows for each record, each row accounts for a different type of outcome
I'm having trouble with MySQL date comparison. I'm looking for some kind of query that will compare
the all date column and only give me the latest date. Then once I have it, ...
|
by: Richard Hollenbeck |
last post by:
I'm trying to write some code that will convert any of the most popular
standard date formats twice in to something like "dd Mmm yyyy" (i.e. 08 Jan
1908) and compare the first with the second and calculate days, months, and
years. This is not for a college course. It's for my own personal
genealogy website. I'm stumped about the code. I'm working on it but not
making much progress. Is there any free code available anywhere? I know it...
|
by: Steve Wright |
last post by:
I am trying to validate if an entry on a form is a date.
I have adapted code I found here
http://www.codingforums.com/archive/index.php/t-14325 as below but I can't
seem the get the results that I am expecting.
Can anyone help please
TIA
Steve
PS I'm new to javascript
|
by: JIM.H. |
last post by:
Hello,
Since I am learning C# now, I might have a simple question, I know my
datarow dr keeps datatime and I need to compare it if it is current
date, if not how many days ago? How should I compare date and find how many
day difference?
Thanks,
Jim.
|
by: John Wildes |
last post by:
Hello all
I'm going to try and be brief with my question, please tell me if I have the
wrong group.
We are querying transaction data from a DB3 database application. The dates
are stored as text fields. Each date for example 10/31/03 or October 31st
2003 is stored as 10/31/A3 in the system. My reasoning for this is because
they couldn't solve their Y2K problem or this is their solution to it. All
dates prior to 2000 are stored...
| |
by: Bob Achgill |
last post by:
I would like to use the timestamp on files to manage the
currency of support files for my VB windows application.
In this case I would only put the timestamp of the file
in the management database and not the file itself.
To do this I will need to have a File class property for
Create time and date that will let me "set" the Create
time and date of the file to my own chooseing.
The VB file class does not appear to have the ability
|
by: blini |
last post by:
Helo.... How I can convert string "26/03/2006 15:51" for a date? I need
to convert and to compare if "09/06/2006 14:20" is lesser or equal that
the current date. Everything in Javascript.
|
by: Assimalyst |
last post by:
Hi,
I have a working script that converts a dd/mm/yyyy text box date entry
to yyyy/mm/dd and compares it to the current date, giving an error
through an asp.net custom validator, it is as follows:
function doDateCheckNow(source, args)
{
var oDate = document.getElementById(source.controltovalidate); //
dd/mm/yyyy
|
by: keri |
last post by:
Hi,
I am creating a table where I want to use the date as the primary key -
and to automatically create a record for each working date (eg Mon to
Fri) until 30 June 2007. Is this possible? I do not want my user to
have to create a record for each date.
Thanks,
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |