Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7413227
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T06:39:48+00:00 2026-05-29T06:39:48+00:00

I am trying to import data from Access to Excel based on two parameters.

  • 0

I am trying to import data from Access to Excel based on two parameters. I have a list of tools which specify a project number (parameter 1) and a tool type (parameter 2). How can I filter out the tools that don’t satisfy the user’s input of these two parameters?

I saw this thread: Import to Excel from Access table based on parameters

but it doesn’t talk about multiple parameters. Here is where I am at so far:

    Dim cn As Object
Dim rs As Object
Dim strFile As String
Dim strCon As String
Dim strSQL As String
Dim s As String
Dim i As Integer, j As Integer

''Access database

strFile = "D:\Tool_Database\Tool_Database.mdb"

''This is the Jet 4 connection string, you can get more
''here : http://www.connectionstrings.com/excel

strCon = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & strFile & ";"

''Late binding, so no reference is needed

Set cn = CreateObject("ADODB.Connection")
Set rs = CreateObject("ADODB.Recordset")

cn.Open strCon

'Find the name of the tool that was selected
Dim SelectedTool As String, SelectedProj
Set SelectedTool = Tools_ListBox.Selected
Set SelectedProj = Project_ListBox.Selected

strSQL = "SELECT * " _
        & "FROM ToolFiles " _
        & "WHERE Tool_Name = '" & SelectedTool & "'"

rs.Open strSQL, cn, 3, 3

Worksheets("ToolList").Cells(2, 1).CopyFromRecordset rs

rs.Close
Set rs = Nothing
cn.Close
Set cn = Nothing

Obviously the strSQL statement is where I need to get focused and insert the value into SelectedProj.

Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T06:39:49+00:00Added an answer on May 29, 2026 at 6:39 am

    If you just wanted to add the SelectedProj to the SQL statement, this should be the trick (where ProjectType is the name of the field):

    strSQL = "SELECT * " _
            & "FROM ToolFiles " _
            & "WHERE Tool_Name = '" & SelectedTool & "' " _
            & "AND ProjectType = '" & SelectedProj & "'"
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the unfortunate task of having to import data from excel into a
I’m trying to import fixed width data from text file into SQL Server Express
In this situation I am trying to perform a data import from an XML
I am trying to import an excel file into a data table using GemBox
I'm trying to write an import function for getting data out of an excel
I am trying to import an access database to mysql. I have created a
I am trying to import the contact list from gmail using libgmailer.php but I
I'm trying to import an 82k+ row table from an access db to SQL
I'm using WSGI and trying to access the get/post data, using this code: import
I have some code to retrieve XML data: import cStringIO import pycurl from xml.etree

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.