yet another partial match question...

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • zmbd
    Recognized Expert Moderator Expert
    • Mar 2012
    • 5501

    #16
    it is the easy stuff

    As I've said in another post, "...Good Chemistry is Lazy Chemistry: If you're beating your head against the wall over a problem, you've missed something easy - step away from the problem..." - The Late Dr. Palma (Chemisty Prof)

    The elegant solution:
    When the user clicks on the command button to launch the new history event form for the asset.
    -The vba code looks at the newest record by date in the
    recod set to fetch the value of the last status.
    Code:
    zstrcurrentstat = newestrecord![status_id]

    - now a simple lookup on the status table:
    Code:
    zstrnextallowed = DLOOKUP("NextAllowedStatus","tbl_status","[status_id]=" & zstrcurrentstat)
    -now we have the list for the next allowed states so we can build the query:

    Code:
    zSQL =
    "SELECT tbl_status.status_ID, tbl_status.status_name " & _
    "FROM tbl_status " & _
    "WHERE tbl_status.status_id IN (" & zstrnextallowed & ");"
    This is then set as the record source for the combo-box

    Amazing what getting away from the issue will do for the mind.

    That wonderfull "IN" of the "WHERE" clause.

    Happy Easter

    -z
    Attached Files
    Last edited by zmbd; Sep 16 '14, 08:51 PM. Reason: HAPPY EASTER

    Comment

    Working...