Access 2007 Date Validation Test Not Working

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • burnin240sx
    New Member
    • Aug 2008
    • 2

    Access 2007 Date Validation Test Not Working

    I am trying to get access to run this VBA code after the manufacture date is entered. the code should populate Legacy or New depending if the product was made before of after 1/31/08.
    My code is acting like it is not running and I can't get access to break at the if statement for debuging. Am I doing something wrong?

    Code:
    Private Sub Manufacture_Date_AfterUpdate()
    If (Me.Manufacture_Date > #1/31/2008#) Then
    Me.Legacy_Or_New = "New"
    Else
    Me.Legacy_Or_New = "Legacy"
    End If
    End Sub
  • janders468
    Recognized Expert New Member
    • Mar 2008
    • 112

    #2
    Does it break any where in the code? I.e. is the event being fired?

    Comment

    • RuralGuy
      Recognized Expert Contributor
      • Oct 2006
      • 375

      #3
      Do you open the db while holding down a <SHIFT> key? That should help.

      Comment

      • missinglinq
        Recognized Expert Specialist
        • Nov 2006
        • 3533

        #4
        Do you have any VBA code in the db that runs? I ask because your code looks valid. In 2007, no code will run unless you've declared the folder your app resides in as a "Trusted" location. To do this:

        Click the "Office" button in the upper left,
        Go to Access Options/ Trust Center
        Add the folder holding the db to the list of trusted locations.

        Welcome to Bytes!

        Linq ;0)>

        Comment

        • burnin240sx
          New Member
          • Aug 2008
          • 2

          #5
          I have code in a few other fields on my form that execute just fine. I was able to get the debuger to stop when I opened with the left shift.

          I solved the issue by putting the who if statment on 1 line. with it the was i posted above it showed me error or
          "end if without if statment"
          Which was very confusing.
          Thank you for the help.

          Comment

          Working...