Results 1 to 4 of 4

Thread: Point of focus

  1. #1
    Join Date
    Aug 2006
    Location
    Lincoln, UK
    Posts
    24

    Unanswered: Point of focus

    Morning all

    I have another question to excercise the grey matter.

    I have a table which contains dates. I want to create a form which, when opened, displays todays date as the point of focus, but still shows all other records.

    A query won't do the job, that will only display records with todays date in it.

    EG

    19/09/06
    20/09/06
    21/09/06
    22/09/06 I want this want to be where the form opens, but show the rest
    23/09/06

    Regards
    Das
    ----------------------------------------------------

    One day, I'll have learnt so much that I'll be able to answer questions as well!!

  2. #2
    Join Date
    Jun 2005
    Location
    Richmond, Virginia USA
    Posts
    2,763
    Provided Answers: 19
    Is this a contiuous form or one that shows a single record at a time, where you want the first record showing to be the one that holds todays date in a certain field? If the latter, this will work:

    Code:
    Private Sub Form_Load()
    Set rs = Me.Recordset.Clone
            rs.FINDFIRST "[TargetDate] = date()"
            Me.Bookmark = rs.Bookmark
    End Sub
    where [TargetDate] is the name of the field holding your desired date.

    If it's a continuous form, I haven't a clue! Try to avoid them, whenever possible!
    Hope this helps!

    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

  3. #3
    Join Date
    Sep 2003
    Location
    MI
    Posts
    3,713
    Quote Originally Posted by Missinglinq
    Is this a contiuous form or one that shows a single record at a time, where you want the first record showing to be the one that holds todays date in a certain field? If the latter, this will work:

    Code:
    Private Sub Form_Load()
    Set rs = Me.Recordset.Clone
            rs.FINDFIRST "[TargetDate] = date()"
            Me.Bookmark = rs.Bookmark
    End Sub
    where [TargetDate] is the name of the field holding your desired date.

    If it's a continuous form, I haven't a clue! Try to avoid them, whenever possible!
    With a continuous form you can do it this way: Have an autonumber column that represents the record # and row # in the form. Search for your date and return the row #. Issue the GotoRecord command to that row # ...
    Back to Access ... ADO is not the way to go for speed ...

  4. #4
    Join Date
    Aug 2006
    Location
    Lincoln, UK
    Posts
    24
    The form is a continuous form, but, Missingling's suggestion worked fine first time. Sorry Grand Poobah, he answered first.

    As ever, thanks for the help.

    Regards
    Das
    ----------------------------------------------------

    One day, I'll have learnt so much that I'll be able to answer questions as well!!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •