Results 1 to 3 of 3
  1. #1
    Join Date
    Mar 2011

    Unanswered: view link if a document is there,else don't view it


    In a MS SQL table i have the fields Comment,Code,Username and Document.In our system users can use this table to enter Comments and Codes,and upload a pdf document.In a view on a form i want users to be able to see other's users comments or uploaded documents.If a document is there the link should be viewed,but if there is no document there should be nothing.This is what i managed to build thusfar:

    SELECT Username,Comment,Code,'<a href='+Document+'>doclink''</a>'Document FROM EKB_ENG_COMMENTS_TEST ORDER BY Username,Comment,Code,Document

    In this case there is always a link in the view,which i do not want,i only want a link if there's a document.

    All things i've tried with CASE Document IS NOT NULL THEN etc ended in syntax errors.

    Can anyone help me out ?
    Attached Thumbnails Attached Thumbnails view_table.jpg  

  2. #2
    Join Date
    Mar 2003
    The Bottom of The Barrel
    Provided Answers: 1
    I would handle this on the front end. Just return the Document in the query. Leave it up to whatever you're using to present records to the user to decide when to display a link or not.
    oh yeah... documentation... I have heard of that.

    *** What Do You Want In The MS Access Forum? ***

  3. #3
    Join Date
    Mar 2009
    If you concatenate a null value then you should get a null value in the column -unless for some reason you are setting CONCAT_NULL_YIELDS_NULL to OFF on your connections.

    Ergo, '<a href='+Document+'>doclink''</a>' should equal null if the value of [Document] column is null...

Posting Permissions

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