Results 1 to 15 of 15
  1. #1
    Join Date
    Sep 2008
    Posts
    101

    Unanswered: Returning 1 record from numerous results

    Hi, i have a filter button setup using macros and a query at the moment where it brings back all the records that is equal to certain criteria, what i would like it to do is only bring back 1 record from a result of i.e 20 once a button is clicked. how would my query look for this?as i would like it to only bring back 1 record at a time as the button would also add initials to the record of whos dealing with it(dont worry i have the initials function working)until all the records have been dealt with.
    thanks

  2. #2
    Join Date
    May 2005
    Posts
    1,191
    I'm not sure how you intend to use it but have a look at the TOP operator of a SELECT SQL statement, or else have look at DLookup() or elookup().
    Me.Geek = True

  3. #3
    Join Date
    Sep 2008
    Posts
    101
    we have a table where someone adds all the callbacks for designated times, i.e. 10-12pm, 12-2pm, the query brings back all the records where the criteria is depending on what button they press 10-12pm,12-2pm etc....
    when the button is pressed it brings back all the results i.e 20 records....and you can scroll through the records and cherry pcik which one you would like to call, what i would like is for the button to only return one record out of the 20 records so the person cannot scrolll through the results and cherry pick the records for the callback
    cheers

  4. #4
    Join Date
    Sep 2008
    Posts
    101
    or maybe if we can hide certain details on the form until someone presses the button, but would only show details from that record after its been pressed and the rest of the details on the other records stay hidden until the user is on that record and they press the button. if this makes sense?

  5. #5
    Join Date
    Sep 2008
    Posts
    101
    can anyone help me on the above?

  6. #6
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    Did you look up the TOP operator?
    Testimonial:
    pootle flump
    ur codings are working excelent.

  7. #7
    Join Date
    Sep 2008
    Posts
    101
    How would that work in sql?

  8. #8
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    Testimonial:
    pootle flump
    ur codings are working excelent.

  9. #9
    Join Date
    Sep 2008
    Posts
    101
    it keeps on giving me this message "The SELECT statement includes a reserved word or argument name that is misspelled or missing, or the punctuation is incorrect"
    this is the sql stament im using:
    SELECT TOP 1
    FROM Workflow
    WHERE (((Workflow.[Preferred Contact Time])="10-12pm") AND ((Workflow.[Preferred Contact Date])<=Date()));

  10. #10
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    SELECT TOP 1....what? You need to specify columns still!
    Testimonial:
    pootle flump
    ur codings are working excelent.

  11. #11
    Join Date
    Sep 2008
    Posts
    101
    at the moment i have a macro running which applies a filter from the query i created, so would it mater what columns i select? as the records will still be brought back when the filter is applied?

  12. #12
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    I don't understand the question. You should return the columns you need; no more, no less.
    Testimonial:
    pootle flump
    ur codings are working excelent.

  13. #13
    Join Date
    Sep 2008
    Posts
    101
    all sorted now pootle thanks but a quick question, if 2 users brought back the same result at the same time and then they updated the owner field with their initial at the same time using a macro would this crash the system?

  14. #14
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    It all depends. You are talking now about row locking and transactions. It also depends by what you mean by "crash the system".

    Usually, by default, if that occurs the second user (the one that attained a lock on the row second) will get a message box telling them that another user has changed the row. They will be asked if they want to discard their changes or overwrite the changes of the first user.
    Testimonial:
    pootle flump
    ur codings are working excelent.

  15. #15
    Join Date
    Sep 2008
    Posts
    101
    thanks again pootle flump

Posting Permissions

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