Results 1 to 2 of 2
  1. #1
    Join Date
    Jun 2006

    Unanswered: TXT to MYSQL using VBA??

    Hello. I have a .TXT file. I want to make a code in VBA that will read . TXT and send this information to MYSQL. I created a ODBC driver but how can i connect it using VBA and then, atrributes a value to a table in SQL??

  2. #2
    Join Date
    Mar 2005
    The best way to connect to a database using vba is ado.

    You should be able to use ADO to connect to the database directly. The hard part is the connection string use to access the database. Here is a link that will show some connection string examples:

    Here is another web site that may help you:

    Just remember that you will check the ado in the reference library in the vb editor to use the ado objects.

    I would use the ado command object and create a store procedure in database itself. Then all you would have to do is pass the parameters and execute it.

    It makes it a lot easier than trying to write the sql in vba. It can be very tricky. Plus it lets the database do the work and all you do is pass values. Better performance than trying to hard parse an sql string. I will see if I can come up with some specific example for this.

Posting Permissions

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