Results 1 to 5 of 5
  1. #1
    Leeselson is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Jun 2012
    Posts
    2

    VBA Programming

    This Routine works on my machine running XP but not on my machine running Windows 7. Both machines are running Access 2007. Any Ideas why it won't work on the Windows 7 machine ?



    Private Sub EndDate_GotFocus()

    If [StartDate] < "03/23/2012" Then
    MsgBox " The Date Must Be Greater Than 03/22/2012"
    StartDate.SetFocus
    End If
    End Sub

  2. #2
    Jester0001 is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    Feb 2012
    Location
    Indiana
    Posts
    69
    Is there an error that comes up when the code is run? Is the file located in a Trusted Location? Make sure the file is located in a Trusted Location in Win7, otherwise it will prevent code from running. Check the link below for more info.

    http://msdn.microsoft.com/en-us/libr...ice.12%29.aspx

  3. #3
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,870

  4. #4
    Leeselson is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Jun 2012
    Posts
    2

    Brillant

    Quote Originally Posted by orange View Post
    If startdate is a dateTime datatype, perhaps you should use
    If [StartDate] < #03/23/2012#
    Orange:

    That was the answer. I so appreciate your help. I am writing this database in Access 2007 that is why I used the default 2007 type. I would not have picked up on that as the solution.

  5. #5
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,870
    Dates are enclosed in #myDate#
    Text is enclosed in "myTextfld"

    Good luck with your project

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Programming a gauge
    By ruthib4 in forum Programming
    Replies: 6
    Last Post: 11-30-2011, 03:43 AM
  2. Monthly Programming
    By ekaragew in forum Programming
    Replies: 1
    Last Post: 06-21-2011, 05:37 PM
  3. Programming
    By JLT in forum Programming
    Replies: 10
    Last Post: 04-14-2011, 10:07 AM
  4. Most likely a programming thing
    By dfelock in forum Programming
    Replies: 7
    Last Post: 12-21-2010, 11:10 AM
  5. VB Programming
    By mstefansen in forum Programming
    Replies: 4
    Last Post: 08-31-2009, 07:15 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums