• Access field caption

    Author
    Topic
    #376220

    I’d like to use an Access field caption in an ASP page instead of the field name. Here’s the code I’m using:

    : <input type="text" name="” value=””>

    Replacing the line with doesn’t work. Any guidance is greatly appreciated!

    Thanks,
    Kathy

    Viewing 0 reply threads
    Author
    Replies
    • #615290

      Hi Kathy,

      As you well know, you’re using the ADO objects to connect to the Access database. Caption is a property that belongs to Access, not the ADO objects. Therefore reading Access’s Caption property for a database field is not possible through the current version of ADO.

      Sorry shrug

      As an alternative, you could create a table with 2 colums: field_name and field_caption. Then pull the captions from the second table and the values from the original. Just be sure to make the order of the records in the second table to match the order of the fields you’re using in the first table.

      Hope this helps

      Mark

      • #615293

        I was hoping there was a way to get to the Access property — it certainly explains why I couldn’t find a reference for it in my ASP material…

        Thanks for the work around idea!

        Kathy

        • #615350

          Kathy,

          I was just struck by a thought… brickwall

          Another, much easier alternative would be to create a query in Access with your desired captions as the fieldnames in the query. Your Field Name row in Access would read:

          My Field Name: [myfield]

          The SQL will say something like: SELECT myfield AS [My Field Name] FROM…

          This makes much more sense than creating a second table…sorry for the confusion.

          • #615501

            No apologies! I’m glad you replied so quickly — it stopped me from a futile search. Your new suggestion does sound easier. I greatly appreciate your help!!

            Thanks again,
            Kathy

    Viewing 0 reply threads
    Reply To: Reply #615501 in Access field caption

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information:




    Cancel