+ Reply to Thread
Results 1 to 6 of 6

Select item from access

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    08-07-2013
    Location
    mo
    MS-Off Ver
    Excel 2010
    Posts
    453

    Select item from access

    How can I change this line to look at a cell value for the search criteria in access




    Src = "Select Flow FROM History WHERE [Month] = 40787 " & "and [Segment] = 'combined' " & "and [CO OW Market] = 'Abbotsford' " ' good
    I want to take out 40787 and have it in range("G5") and change 40787 in the above code to look at the cell instead. Mabe something like whats below, but its currently not working

    Src = "Select Flow FROM History WHERE [Month] = range("G5").value " & "and [Segment] = 'combined' " & "and [CO OW Market] = 'Abbotsford' " ' good

  2. #2
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2406 Win 11 Home 64 Bit
    Posts
    24,029

    Re: Select item from access

    See if this blog helps

    http://datapigtechnologies.com/blog/...ry-from-excel/
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  3. #3
    Forum Contributor
    Join Date
    08-07-2013
    Location
    mo
    MS-Off Ver
    Excel 2010
    Posts
    453

    Re: Select item from access

    I tried looking and using but I am not have luck. It seems so simple, I have been trying different things for 2 hours now.

  4. #4
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2406 Win 11 Home 64 Bit
    Posts
    24,029

    Re: Select item from access

    Using your current code, add a line before

    Dim rng as date
    Set rng = Range("G5")
    Now substitute the hard code with rng

  5. #5
    Forum Contributor
    Join Date
    08-07-2013
    Location
    mo
    MS-Off Ver
    Excel 2010
    Posts
    453

    Re: Select item from access

    I am getting compile error: Object required and the rng is selected when I try that. Here is what I did:

    Dim rng as date
    Set rng = Range("G5")
    Src = "Select Flow FROM History WHERE [Month] = Rng " & "and [Segment] = 'combined' " & "and [CO OW Market] = 'Abbotsford' " ' good

  6. #6
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2406 Win 11 Home 64 Bit
    Posts
    24,029

    Re: Select item from access

    My bad. Remove the word Set from the line of code.

+ 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. Using VBA to Select Dropdown Item
    By Ric_W in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-21-2013, 02:12 PM
  2. Select One Item PivotTable VB
    By elfvis in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-05-2012, 10:34 AM
  3. Select Combobox Item With List Item Select
    By bdb1974 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 04-22-2011, 02:40 PM
  4. [SOLVED] Would like to select more than one item in a list
    By magickarle in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-01-2005, 03:40 PM
  5. How select an item in a list box
    By jamie81 in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 09-06-2005, 03:05 AM

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