Consulting

Results 1 to 9 of 9

Thread: SQL with excle data

  1. #1

    SQL with excle data

    I have a combo box to list data from a spreadsheep. Can I use ADO connection and recordset to SQL data from a excel spreadsheep? If so, what is the syntex?

    Thanks in advance.

  2. #2
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,445
    Location
    Are you trying to update Access from Excel?

    Do you want to update Access with a combo range, or something else?
    Last edited by Bob Phillips; 09-23-2008 at 05:19 AM.
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  3. #3

    Update Access with Excel

    Quote Originally Posted by xld
    Are you trying to update Access from Excel?

    Do you want to update Access with a combo cgange, or something els?
    Yes, I'm trying to update a combo box in Access with the data from Excel.

    Thanks.

  4. #4
    VBAX Master stanl's Avatar
    Joined
    Jan 2005
    Posts
    1,141
    Location
    Quote Originally Posted by dhartford
    Can I use ADO connection and recordset to SQL data from a excel spreadsheep?
    Should be a matter of opening up a connection object to the worksheet that contains the data, then populating the combo box with additem() assuming you have created an Access form.

    There is no use in proceeding unless you can verify the Excel data can be queried in ADO. No use guessing at that, best if you could attach a sample of the Excel data. .02 Stan

  5. #5
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,445
    Location
    It is simple to to use ADO to query Excel, and you can always retrieve the data intoan array, and load the combo with the array.
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  6. #6
    VBAX Regular
    Joined
    Sep 2008
    Posts
    36
    Location
    Here's one approach. Let's say I have an external Excel spreadsheet, where the first page contains a list of items I want to use to populate the dropdown.

    In Access, I select File/Get External Data/Link Tables
    In the dialog box, I select the Excel file type from the dropdown and point to the Excel file.

    I now have a link table in Access that points to the Excel sheet. Now, I can write a simple query for it, and then use that query as the source for the dropdown.

    If this works for you, there's no need to use ADO or recordset. The Access link will take care of it.

    S

  7. #7

    Can't link the data in.

    Quote Originally Posted by Slyboots
    If this works for you, there's no need to use ADO or recordset. The Access link will take care of it.

    S
    Thank you for your reply. But I don't want user to view the data in spreadsheet, so can't link the spreadsheet in.

  8. #8
    VBAX Master Norie's Avatar
    Joined
    Jan 2005
    Location
    Stirling, Scotland
    Posts
    1,831
    Location
    You don't want the user to view the data from the spreadsheet?

  9. #9
    VBAX Master CreganTur's Avatar
    Joined
    Jan 2008
    Location
    Greensboro, NC
    Posts
    1,676
    Location
    dhartford,

    take a look at my response to your listbox problem. You can use everything I provided for your listbox to populate your combobox with data- you just need to reference the correct object.
    -Randy Shea
    I'm a programmer, but I'm also pro-grammar!
    If your issue is resolved, please use Thread Tools to mark your thread as Solved!

    PODA (Professional Office Developers Association) | Certifiable | MOS: Access 2003


Posting Permissions

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