Results 1 to 9 of 9

Thread: Getting the column name that appears to the user

Hybrid View

  1. #1

    Thread Starter
    Member
    Join Date
    Feb 2012
    Posts
    35

    Re: Getting the column name that appears to the user

    Quote Originally Posted by TysonLPrice View Post
    I'm on MS SQL but I think you need to do the leg work yourself. I don't see how the database can know what aliases you are using in queries and VB code unless they were actually assigned on the DB (if possible).
    I'd be interested to know if it can be done with a simple report.
    In fact, the names are assigned on DB and I need to get them in my app using VB code. It´s possible to get real/internal names but I don´t know how to get the names that appears to the user. That´s the problem.

    If I create that list I have mentioned before and in the future someone (or myself) changes the DB, then I will need to remember to update that list. That´s why I´m trying to avoid creating that list.
    Last edited by jalexm; Feb 29th, 2012 at 12:17 PM.

  2. #2
    Wall Poster TysonLPrice's Avatar
    Join Date
    Sep 2002
    Location
    Columbus, Ohio
    Posts
    3,969

    Re: Getting the column name that appears to the user

    Quote Originally Posted by jalexm View Post
    In fact, the names are assigned on DB and I need to get them in my app using VB code. It´s possible to get real/internal names but I don´t know how to get the names that appears to the user. That´s the problem.

    If I create that list I have mentioned before and in the future someone (or myself) changes the DB, then I will need to remember to update that list. That´s why I´m trying to avoid creating that list.
    I don't know Access but you lost me here. Where does TabDepts.CodDept display as "Dept. Code"? What would you see if you ran this query against the DB?

    Select TabDepts.CodDept from Mytable where TabDepts.CodDept = 'VBForums'

    Would you see:

    CodDept
    VBForums

    or

    Dept. Code
    VBForums

    I guess what I'm thinking is selects are using aliases or what the user sees is manipulated in the program and you will need to find them there, not on the DB.

    Otherwise...I'm all wet

  3. #3

    Thread Starter
    Member
    Join Date
    Feb 2012
    Posts
    35

    Re: Getting the column name that appears to the user

    Quote Originally Posted by TysonLPrice View Post
    I don't know Access but you lost me here. Where does TabDepts.CodDept display as "Dept. Code"? What would you see if you ran this query against the DB?

    Select TabDepts.CodDept from Mytable where TabDepts.CodDept = 'VBForums'

    Would you see:

    CodDept
    VBForums

    or

    Dept. Code
    VBForums

    I guess what I'm thinking is selects are using aliases or what the user sees is manipulated in the program and you will need to find them there, not on the DB.

    Otherwise...I'm all wet
    Sorry for the delay.

    In fact, my app uses a DB created in Access but everything is made by my app.

    When an error occurs, Access send a message to my app and it shows something like "TabDepts.CodDept is not valid." (I can't remember exactly). I can trap the error and get its number and message.

    This way I can avoid to show the original message to the user. Next step is to find "TabDepts.CodDept" string in original error message and replace it by "Dept. Code" and show the new message: "Dept. Code is not valid."

    I can do all of these things, but I don't have a way to get the column names that appear to the user. I can get only internal/real names although both are defined in Access.

    No problem if I have few fileds/columns. But there are many. That's the problem.

Posting Permissions

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



Click Here to Expand Forum to Full Width