Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Modules / DAO / VBA / February 2008

Tip: Looking for answers? Try searching our database.

Help needed on some code.

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
jfaz - 29 Feb 2008 11:59 GMT
I am new to coding and have had some success but am baffled by this.

I have a form that I wish to ensure that the end date is the same as or
after the start date.  I have attached the following code but it fails at the
point where I am trying to clear out the end date field of the data entered.

I would be grateful if someone could point out to me where I am going wrong.

Private Sub End_Date_BeforeUpdate(Cancel As Integer)
If (Me.[End_Date]) <= (Me.[Start Date]) Then
MsgBox "Your must input a date after or the same as your start date"
[End_Date] IsNull
End If
End Sub

Any help would be welcome.  Thanks in anticipation.
Jeanette Cunningham - 29 Feb 2008 12:03 GMT
Change this line:
    [End_Date] IsNull
To
   Cancel = True

Jeanette Cunningham

>I am new to coding and have had some success but am baffled by this.
>
[quoted text clipped - 15 lines]
>
> Any help would be welcome.  Thanks in anticipation.
John Spencer - 29 Feb 2008 12:28 GMT
Are you try to set End_Date to Null?  If so, the statement is
  End_Date = Null

If that is not what you are attempting to do, then please post back with a
little more explanation.

Signature

John Spencer
Access MVP 2002-2005, 2007-2008
Center for Health Program Development and Management
University of Maryland Baltimore County
.

>I am new to coding and have had some success but am baffled by this.
>
[quoted text clipped - 15 lines]
>
> Any help would be welcome.  Thanks in anticipation.
Paolo - 29 Feb 2008 13:09 GMT
Hi jfaz,
I would add another suggestion to those already given by others:

with the if statement you wrote, i.e. Me.[End_Date]) <= (Me.[Start Date],
you reject Me.[End_Date]) = (Me.[Start Date] and I think you wanna allow this
conditions, so your if must be Me.[End_Date]) < (Me.[Start Date]

Cheers Paolo

> I am new to coding and have had some success but am baffled by this.
>
[quoted text clipped - 12 lines]
>
> Any help would be welcome.  Thanks in anticipation.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.