• HTML format in Access or VB (Access 97 SR2)

    Home » Forums » AskWoody support » Productivity software by function » MS Access and database help » HTML format in Access or VB (Access 97 SR2)

    • This topic has 12 replies, 4 voices, and was last updated 22 years ago.
    Author
    Topic
    #387872

    Hi,
    I’ve had a request to investigate the use of text in Access and VB (primarily Access though).
    There are 2 levels to this:

    Is there a way to have a form with an area where html format of text can be written.
    Is there a way to save this information into a database. A sub goal of this may also be to save the contents of an email into a database (i.e. including text style and layout).

    I have started to experiment with the Rich Textbox control in Access and the OLE control in VB but havent had any luck so far. I have also started going through some search engines etc, but thought a quick question here would be a good idea to start the ball rolling!

    Any help or pointers in the right direction would be much appreciated.

    Viewing 2 reply threads
    Author
    Replies
    • #678642

      Hmmm. Not quite sure what you’re after, but…

      Not too long ago I wrote a program to html things so that a web page could be built. The requirements included that the user didn’t know how to do html. Basically, I had them type into a memo field and the appended all the html tags through code. All of the information was retained in the access database, so that when the users were all done entering the information, someone could press a button and the page would be built automagically.

      Other than that, I’m not sure what html format of text means, because html is just plain text with markup tags surrounding it.

      Other suggestions? In VB you can imbed Word, which has html capabilities….

      HTH,

    • #678795

      If you mean you want to *see* the html in Access, you would need to use something like a browser control on an Access form to display it, I think. If you’re trying to build an HTML editor in Access, I don’t see the point. The rich text control is for formatted text. HTML is *not* formatted text, it is text that is being presented by an html-aware application. I can’t think a any good reason to store email formatting in Access, especially since the format depends both on how it was sent and on the settings on the receiving end.

    • #678821

      Thanks for your suggestions.

      I think further information may be needed and I think I used incorrect terminology with HTML. I think I should have said Rich Text.

      I have been asked to produce a system that allows the following.

      A button to be pressed on a current database that takes a load of information and puts it in an email. The user can then edit this email if they want to. If the email is sent, the content of the email needs to be stored in a table in SQL. An email history function then needs to be written to retrieve the saved information and view the old emails. The system needs to support all Rich Text features such as bold, underline and fonts.
      As far as I can tell there can only be 3 answers:
      1 – It can’t be done.
      2 – The text can be captured from a mail client program when the send button of that program is pressed.
      3 – A “fake” mail client program needs to be created with a form that is pretty much identical to, for example, a new outlook email.

      I think I need to tackle the storing data part first, then the capturing the text from the email, then the editing of the email. The reason being, if I can’t store it in tables then I may as well use the mail client. If I can capture the text from a mail client app then I dont need to build my own form for writing the email.

      Hope that explains it a bit further.
      Regards,

      • #678841

        I’ve found out a few answers since my last post. Namely the OLE object data type!
        Therefore, Im now trying to get my database to open a new email, and copy that email to a field of OLE object (image in SQL) data type.

        A push in the right direction would be very welcome. Thanks.

        • #678852

          If this is a history file and you’re going to be storing OLE datatypes, what volume are you expecting? This sounds like a candidate for SQL Server early on.

          • #678858

            I agree. So i’ve created a table in SQL with an image (ole object) field and linked it to my Access database. I assume there is a command for adding records with such a field so im looking into the following:

            with rec
            .addnew
            !companyID = me.company
            !date = date()
            !emailobject = “C:test.rtf”
            .update
            end with
            rec.close

            I know that isnt the code to do it, and im currently looking through the help files and a few books for the solution. After I have worked out how to append to an OLE Object field, im going to look into detecting outlook application functions and see if I can export an open email to a file when the user clicks send and store that file in the ole object field.

            Thats the plan anyway!

            Thanks for the tip Charlotte.

            • #678861

              Eek! Change the name of the date field to something besides “date” or you’ll run into problems with Access, since Date is a built in function and a reserved word in Access. Are you stuck with A97?

            • #678862

              Sorry, that was just an example and a bad one at that – I learnt the reserved word lesson the hard way with someone elses VB application I was trying to fix!! Quite a few hours spent there before I worked it out!

              Unfortunately we are stuck with Access 97. Management thought about going to Access 2000 but found the code didnt convert very well, so from a development point of view we’d stick with 97 until moving completely to VB……. and maybe .NET!!!! (scary business from my point of view).

            • #678868

              To put in my 2cents, VB and .NET will never replace an Access database front-end in terms of development cost or functionallity. So management deciding not to go to 2000 (or later) will ultimately be an expensive decision in my view.

              I understand that you are storing emails that are the ones you send out, and that they are HTML formatted, not RTF or plain text. In that case it seems like using an Image field in SQL Server may well be overkill, as HTML is just plain text as Charlotte points out. Now if you were storing both incoming and outgoing mail that could well be RTF (or a Word format for attachments) then you would need something like the Image field.

            • #678869

              Basically, I want to be able to open a new email from my database, maybe edit that email, and when I send that email the contents need to be copied to a table in a format where I can view them later in exactly the same layout (bold, tabs, different fonts etc) as they were in the original email.

              Hope that clears it up a bit.

              So far, I thought grabbing the actual .msg file would be the easiest way, but thats one step closer than no idea at all which is where I was this time yesterday. Any suggestions of a better way would be much appreciated.

            • #679075

              I don’t know what you mean about “found the code didnt convert very well”. I’ve converted a lot of databases from A97 to A2000 and AXP and haven’t had much trouble. If you have compile errors, then Access will decline to convert, but if you do your homework it really isn’t a problem. The worst problem most people have comes from creating a new database in 2k or XP, importing everything from a 97 file and forgetting to change the object model from ADO to DAO. shrug

            • #679234

              Im not entirely sure how much thought was put into the decision to stick with A97 as I wasn’t part of that process. Unfortunate but for now im stuck with A97.

              I havent yet worked out how to programmatically add a record which has an OLE object in it, but i’ve discovered the GetObject command, which im hoping may hold the solution.
              I seemed to be able to set a variable to hold an Excel file, but can’t seem to get it working with an email. Even with the excel file I failed to populate either an ole control or a field in a record.

              If anyone has an example of the funtions use, I would be very grateful for a look.

              Regards,

    Viewing 2 reply threads
    Reply To: HTML format in Access or VB (Access 97 SR2)

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

    Your information: