Results 1 to 8 of 8
  1. #1
    Rameez is offline Advanced Beginner
    Windows XP Access 2003
    Join Date
    Jun 2009
    Location
    Chennai, India
    Posts
    40

    iMPORTING DATA FROM EXCEL TO ACCESS

    I am importing a table from excel to access. It works fine...but my code has certain limitations. I am a novice in Access and Please for God sake help me out...My queries are.
    1. I am hardcoding the name of the mdb file in my vba code.so if someone changes its name, it won't work. can u plz specify what I can add instead of the code below.
    strConn = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
    "Data Source=" & CurrentProject.Path & "\Tool.mdb;"
    tool.mdb is the hardcoding...how to remove it...?????
    2. I am hardcoding the location, where the excel file to be uploaded is present. so my list box populates only excel files from that location. If i want some kind of open folder icon, so that the user can select file anywhere in the computer and populate the list box with it...
    strLocation = "C:\mdrr\"
    Call FillList(ctl, strLocation)


    I don't want to hardcode the location...the listbox should populated excel files from any location, the user choses from a open folder icon.

    PLEASE HELP ME OUT....

  2. #2
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 10 Access 2013 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    I use this API to dynamically locate and select a file.

  3. #3
    Rameez is offline Advanced Beginner
    Windows XP Access 2003
    Join Date
    Jun 2009
    Location
    Chennai, India
    Posts
    40
    I saw it in one of ur previous posts....but when i used it...some error is propping up with ahtAddFilterItem "ahtAddFilterItem"

    Thanks for prompt reply...

  4. #4
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 10 Access 2013 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Did you import everything from START CODE to END CODE? in that link? It should be in a separate module of its own and name the module basFunc for now.

  5. #5
    Rameez is offline Advanced Beginner
    Windows XP Access 2003
    Join Date
    Jun 2009
    Location
    Chennai, India
    Posts
    40

    Smile Thanks a lot

    Thanks Rural Guy...It worked perfectly...i missed a few things when I first checked it....



    In the msgbox the location C:\ is hardcoded...

    MsgBox "You selected: " & ahtCommonFileOpenSave(InitialDir:="C:\", _
    Filter:=strFilter, FilterIndex:=3, Flags:=lngFlags, _
    DialogTitle:="Hello! Open Me!")

    will this mean if i select from another drive...say D:\ it won't work...???

  6. #6
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 10 Access 2013 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    It should work just fine. It just starts on "C:\" but you can move anywhere you want.

  7. #7
    Rameez is offline Advanced Beginner
    Windows XP Access 2003
    Join Date
    Jun 2009
    Location
    Chennai, India
    Posts
    40

    Thumbs up

    oh Thanks...

    I didn't have another drive on my machine...so just asked you...thanks a lot....

  8. #8
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 10 Access 2013 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    You're welcome. Glad you got everything sorted. Thanks for marking this thread as Solved as well.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Importing Excel into Access with few requirements
    By pickolizac in forum Import/Export Data
    Replies: 1
    Last Post: 02-18-2009, 12:02 AM
  2. Replies: 1
    Last Post: 02-10-2009, 09:57 PM
  3. Call Excel Data into Access table
    By jiguvaidya in forum Import/Export Data
    Replies: 0
    Last Post: 09-15-2008, 04:58 AM
  4. Importing from Excel
    By joer in forum Forms
    Replies: 0
    Last Post: 03-14-2007, 02:01 PM
  5. Importing Excel Sheet into Access dbase
    By tonystowe in forum Import/Export Data
    Replies: 0
    Last Post: 12-08-2006, 11:35 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums