Results 1 to 9 of 9

Thread: Lookup

  1. #1
    Join Date
    Oct 2004
    Posts
    57

    Unanswered: Lookup

    Im trying to set up a button that will look up the last record in the table where a field meets a certain criteria. example...the last record where name equals "mike"...thoughts. Thanks for the help.

  2. #2
    Join Date
    Jul 2004
    Location
    Blackburn, UK
    Posts
    169
    me.filter = "Name = 'mike'"
    me.filteron = true
    docmd.GoToRecord,,acLast

  3. #3
    Join Date
    Oct 2004
    Posts
    57
    that worked great...but i need to pull info from that record, not view it...sorry for being vague...any thoughts?

  4. #4
    Join Date
    Jul 2004
    Location
    Blackburn, UK
    Posts
    169
    Wot type of info do you need to pull, do you have a sample of the database?

  5. #5
    Join Date
    Oct 2004
    Posts
    57
    looking at the following:

    me.filter = "Name = 'mike'"
    me.filteron = true
    docmd.GoToRecord,,acLast

    does anyone know the format if I wanted to substitute mike with the variable varX? Thanks

  6. #6
    Join Date
    Sep 2003
    Posts
    228
    Assuming varX is a string

    me.filter = "Name = """ & varX & """"

  7. #7
    Join Date
    Oct 2004
    Posts
    57
    im getting the error "you canceled the previous operation"

    in all honesty, this seems like the long way around something that should be easier. I need to find the last record where a field in the table equals a text box that the user enters. Then from that record I need to pull a field and perform a simple math function on that field and return it to the current record the user is completeing.

    Any thoughts on the error or an esier way to do this?

    Thanks for all the help so far......

  8. #8
    Join Date
    Jul 2004
    Location
    Blackburn, UK
    Posts
    169
    Can you post the database on the site?

    The previous post by ottomatic should work fine

    That would pick up the field and then filter on that field and goto the last record.

    I cant really think of an easier way of doing this.

  9. #9
    Join Date
    Oct 2004
    Posts
    57

    Lightbulb

    I just found an easy way to do this....
    DLast....should have thought of that earlier.

Posting Permissions

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