Results 1 to 6 of 6
  1. #1
    fishhead is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Apr 2015
    Posts
    167

    month formatting

    Can someone help me with this If condition?



    If[Forms]![fInvChkCo]![date]=Month(Now())

    what i would like is to trigger an action if the month stated in [date] is the current month.

    I'm using this in a macro that will open a form if the date is in the current month but i don't seem to be able to get this to work?

    Can anyone suggest what i'm missing here?

    thanks in advance.

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,815
    If Month([Forms]![fInvChkCo]![date])=Month(Now()) Then

    Date is a reserved word and should not use reserved words as names.

    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    fishhead is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Apr 2015
    Posts
    167
    thanks, works perfectly....
    i wasn't aware there were "reserved words"

    who knew.... : )

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,815
    Should have gotten a warning when field was created. Review http://allenbrowne.com/AppIssueBadWord.html
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  5. #5
    fishhead is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Apr 2015
    Posts
    167
    Hummm. lots of reserved words....who knew!

    tks

  6. #6
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,815
    Not all will cause issues but I have encountered some. Once had to rename a field before query filter would work because even wrapping in [] didn't help.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

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

Similar Threads

  1. Replies: 2
    Last Post: 06-14-2016, 02:36 PM
  2. Replies: 5
    Last Post: 10-08-2014, 02:23 PM
  3. Replies: 43
    Last Post: 08-06-2014, 08:21 PM
  4. Replies: 6
    Last Post: 05-05-2014, 10:51 PM
  5. Replies: 5
    Last Post: 08-20-2012, 11:11 PM

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