+ Reply to Thread
Results 1 to 5 of 5

Excel VBA form - textbox to export data over 255 characters from textbox

  1. #1
    Forum Contributor
    Join Date
    08-29-2012
    Location
    Slough
    MS-Off Ver
    Excel 2007
    Posts
    469

    Excel VBA form - textbox to export data over 255 characters from textbox

    Hi All,

    I have an excel form with text boxes. One of the text boxes is 'Further Comments' and I would like this to hold more than 255 characters.

    Is there a way to export this text field to an Access table please?

    Thanks,

    Danny

  2. #2
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,059

    Re: Excel VBA form - textbox to export data over 255 characters from textbox

    DannyJ,

    First of all, for a textbox to hold more than 255 characters, you will have to make it a multi-line textbox.

    Yes, sending that data to an Access table is fairly easy, but it would help to have more detail. However, this is the basic approach:

    Generally I put my connection strings to the DB in a separate module, since I call them up often:

    Please Login or Register  to view this content.
    Then in whatever triggers the upload (like a button on the form), put this code:

    Please Login or Register  to view this content.
    Note that the access field's data type will have to be memo and not text to accomodate the string length.

    Also, in Excel, in the VBA editor, go to Tools, References, and put a checkmark next to "Microsoft ActiveX Data Objects 6.1 Library" (This will work for 2010 and above, but if your excel is older, you can also use 2.6 or 2.7 instead of 6.1)
    Last edited by Arkadi; 07-19-2017 at 09:16 AM.
    Please help by:

    Marking threads as closed once your issue is resolved. How? The Thread Tools at the top
    Any reputation (*) points appreciated. Not just by me, but by all those helping, so if you found someone's input useful, please take a second to click the * at the bottom left to let them know

    There are 10 kinds of people in this world... those who understand binary, and those who don't.

  3. #3
    Forum Contributor
    Join Date
    08-29-2012
    Location
    Slough
    MS-Off Ver
    Excel 2007
    Posts
    469

    Re: Excel VBA form - textbox to export data over 255 characters from textbox

    Thank you for your help Arkadi. I will try this tomorrow when I am back in work and feed back.

  4. #4
    Forum Contributor
    Join Date
    08-29-2012
    Location
    Slough
    MS-Off Ver
    Excel 2007
    Posts
    469

    Re: Excel VBA form - textbox to export data over 255 characters from textbox

    Worked great thank you.

    I am inputting the records different than how you have suggested. Would it be better to do it the way you have suggested?

    Here is a snippet of the code I am using:

    Please Login or Register  to view this content.

  5. #5
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,059

    Re: Excel VBA form - textbox to export data over 255 characters from textbox

    No, it is not better to do it my way than yours as far as I know. In my case I don't only work with access but also with our MRP software, which uses a different database. The driver that allows us to connect does not support either of the methods in your code, so I have to actually use sql commands to put data in there, which is why I use my method.

    I'm glad you were able to get it going, and well done on finding another way that works well for you

    Also, thanks for the feedback, the rep, and for marking the thread as solved... much appreciated.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Excel 2010 - Userform - display date from textbox in a label or textbox in 'ddd' format
    By theshybutterfly in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-29-2015, 10:54 PM
  2. Excel 2010 – VBA Userforms – Vlookup via Textbox, display result in another textbox
    By theshybutterfly in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-29-2015, 12:31 AM
  3. [SOLVED] Export Text from textbox in Excel userform to a txt file
    By bloomingcarrot in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-22-2015, 06:11 PM
  4. [SOLVED] vba: copy value of textbox to another textbox in another form
    By saikong051 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-13-2014, 04:05 PM
  5. Replies: 4
    Last Post: 01-29-2014, 05:53 AM
  6. Macro to copy textbox data to a duplicate textbox in another worksheet
    By nitram lowm in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-02-2013, 06:10 AM
  7. Replies: 3
    Last Post: 05-07-2012, 09:46 PM

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1