Results 1 to 2 of 2
  1. #1
    tosv1516 is offline Novice
    Windows Vista Access 2007
    Join Date
    Dec 2011
    Posts
    2

    When starting the program, how set fokus on current date? date()

    Hi.
    I have read a lot , but not found a solution to achieve the following:
    In a db I wish to get to a post of the current day as now() or date() , if it exist.
    If not exist a record holding today's date, I wish to create it, and then work with it ( set focus ).
    The purpose is to have an autoexec that either show the current already started record for today,
    or create a new one to work with, and avoid getting double posts in the db.

    Is there a simple yet effective solution to this ??

    Best regards....


    Torgeir

  2. #2
    pbaldy's Avatar
    pbaldy is online now Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    You can test for a record with the current date using DCount()

    DLookup Usage Samples

    If a record is found, open your form to that record:

    BaldyWeb wherecondition

    If not, open the form in Data Entry mode and populate the date field:

    Forms!FormName.DateFieldName = Date()
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

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

Similar Threads

  1. Getting Tax Period from current date
    By crxftw in forum Forms
    Replies: 3
    Last Post: 07-09-2011, 07:12 AM
  2. SQL Inner Join where date = current date
    By Tyork in forum Queries
    Replies: 2
    Last Post: 11-07-2010, 02:07 PM
  3. Comparing Date with current Date
    By ds_8805 in forum Forms
    Replies: 7
    Last Post: 03-31-2010, 09:31 PM
  4. Replies: 9
    Last Post: 03-19-2010, 10:37 AM
  5. Current Date Error
    By McFly in forum Database Design
    Replies: 4
    Last Post: 02-04-2010, 09:08 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