+ Reply to Thread
Results 1 to 2 of 2

Class quirk?

  1. #1
    Forum Contributor
    Join Date
    12-04-2003
    Posts
    360

    Class quirk?

    I have a module which instantiates a class to set up an ado connection.

    I have a variable:
    Private p_strFileName As String

    I have a property:
    Friend Property Let ADOFileName(ByVal strFileName As String)
    p_strFileName = strFileName
    End Property
    Friend Property Get ADOFileName() As String
    ADOFileName = p_strFileName
    End Property

    in the method I have:
    Set p_Connection = New ADODB.Connection
    p_Connection.Open "Driver={Microsoft Text Driver (*.txt; *.csv)};" & _
    "Dbq=" & ADOFileName & ";" & _
    "Extensions=asc,csv,tab,txt;"

    which causes an error. However, If I hard-code the path in the method:
    strpath = "C:\WINDOWS\Documents and Settings\username\Desktop\Folders\Quantitive\Test"
    Set p_Connection = New ADODB.Connection
    p_Connection.Open "Driver={Microsoft Text Driver (*.txt; *.csv)};" & _
    "Dbq=" & strpath & ";" & _
    "Extensions=asc,csv,tab,txt;"

    I'm missing something here and I cant see what.
    tia,
    matt.

  2. #2
    Forum Contributor
    Join Date
    12-04-2003
    Posts
    360
    for the forum...

    Set p_connection = New ADODB.Connection

    with p_connection
    .provider = "Microsoft.Jet.OLEDB.4.0"
    .connectionstring = "Data Source=FilePath\;Extended Properties='text;HDR=YES;FMT=Delimited'"
    .open
    end with

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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