Results 1 to 4 of 4
  1. #1
    darryaz is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2011
    Posts
    4

    Last Record in File


    This seems like it should be simple but it has stumped me.

    I want to place a text box on a form and display one of the fields from the LAST record of the associated table.

    Any help would be appreciated.

    Thanks.

  2. #2
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    How are you defining last? Last by date? Last by primary key value? Last by some other sorting mechanism?

    and is this going to be on a main form or a subform?

  3. #3
    darryaz is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2011
    Posts
    4
    Quote Originally Posted by rpeare View Post
    How are you defining last? Last by date? Last by primary key value? Last by some other sorting mechanism?

    and is this going to be on a main form or a subform?
    Last by date and also greatest in value. It will be on a main form.

  4. #4
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    I think I would write a query that had the result I wanted as the first record (let's say call it Qry_Lookup)

    then use code to find the value within the query, let's say the field that has the result you want is FLD_THISITEM

    you could have code behind your form that was something like

    dim db as database
    dim rst as recordset

    set db = currentdb
    set rst = db.openrecordset (Qry_Lookup)
    rst.movefirst

    FormFieldName = rst.fields("Fld_THISITEM")

    rst.close
    set db = nothing


    Where FORMFIELDNAME would be the name of the field where you want the value to display on your current form. This also assumes the query has the record you want the information from as the very first record in the query.

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

Similar Threads

  1. Update form record source & accde file
    By snoopy2003 in forum Programming
    Replies: 10
    Last Post: 05-14-2011, 01:10 PM
  2. Replies: 1
    Last Post: 09-27-2010, 10:10 AM
  3. Replies: 2
    Last Post: 03-02-2010, 12:02 PM
  4. importing csv file to append record
    By Tim Hardison in forum Import/Export Data
    Replies: 1
    Last Post: 01-14-2010, 04:24 PM
  5. Attaching a file to a record
    By ildanach in forum Forms
    Replies: 0
    Last Post: 08-16-2008, 07:57 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