Results 1 to 11 of 11
  1. #1
    smartflashes is offline Novice
    Windows XP Access 2003
    Join Date
    Jan 2012
    Posts
    12

    Function or Code to display first and last records in a form


    Hello!
    Is there a simple function or code to be placed in a textbox just to display the first and last record in a range. This will be displayed in a form. i.e.
    1st textbox = function or code to display first record
    2nd textbox = function or code to display last record

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,795
    No, would not be simple. Why do you need this, what are you really trying to accomplish?

    Also, textboxes don't really display an entire record, just one field from a record, unless you use an expression to concatenate fields of record.
    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
    smartflashes is offline Novice
    Windows XP Access 2003
    Join Date
    Jan 2012
    Posts
    12
    Quote Originally Posted by June7 View Post
    No, would not be simple. Why do you need this, what are you really trying to accomplish?

    Also, textboxes don't really display an entire record, just one field from a record, unless you use an expression to concatenate fields of record.
    What I need is very simple. I have simple query that displays two fields, name and num (number). I want two textboxes in a form; one of them displays the first filed of the record 'num'; the second displays the last field of the record 'num'.

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,795
    That gives me an entirely different picture.

    What do you mean by first and last fields? There are only the two?

    Bind form to query, bind textboxes to fields. I.e., set form RecordSource property to the query, set textbox ControlSource property to field.

    Building bound forms is very basic Access functionality and Help has guidelines for this.
    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
    smartflashes is offline Novice
    Windows XP Access 2003
    Join Date
    Jan 2012
    Posts
    12
    I'm sorry if you couldn't get what I want. The attached picture may explain what I want. Of course numbers should appear without brackets.

  6. #6
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,795
    Then maybe not so hard.

    The form is in ContinuousForms view? Try this with textboxes in the form footer:

    =Max([number])
    =Min([number])
    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.

  7. #7
    smartflashes is offline Novice
    Windows XP Access 2003
    Join Date
    Jan 2012
    Posts
    12
    Thanks for help. I solved it myself.

  8. #8
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,795
    Would you like to share your solution?
    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.

  9. #9
    smartflashes is offline Novice
    Windows XP Access 2003
    Join Date
    Jan 2012
    Posts
    12
    Quote Originally Posted by June7 View Post
    Would you like to share your solution?
    With pleasure. Here is what I did,

    =DMax("[glos1]", "lgan1_1", DLookup("[glos1]", "lgan1_1"))
    =DMin("[glos1]", "lgan1_1", DLookup("[glos1]", "lgan1_1"))

    I use these functions because I want to display the min and max numbers of the total numbers and not just the group displayed in the form.

  10. #10
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,795
    Okay, as long as it works, but I don't think the nested DLookup is necessary.

    With that additional understanding on my part, I would have suggested:
    =DMax("[glos1]", "lgan1_1")
    =DMin("[glos1]", "lgan1_1")
    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.

  11. #11
    smartflashes is offline Novice
    Windows XP Access 2003
    Join Date
    Jan 2012
    Posts
    12
    Quote Originally Posted by June7 View Post
    Okay, as long as it works, but I don't think the nested DLookup is necessary.

    With that additional understanding on my part, I would have suggested:
    =DMax("[glos1]", "lgan1_1")
    =DMin("[glos1]", "lgan1_1")
    Thanks. It works very well too.

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

Similar Threads

  1. Replies: 16
    Last Post: 02-13-2012, 03:32 PM
  2. Replies: 11
    Last Post: 10-04-2011, 02:29 AM
  3. Replies: 11
    Last Post: 09-27-2011, 07:19 AM
  4. Date function to query records and Sum records
    By sullynivek in forum Queries
    Replies: 0
    Last Post: 04-05-2011, 08:37 AM
  5. Display ALL records in a form?
    By evander in forum Forms
    Replies: 3
    Last Post: 07-15-2010, 07:59 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