Create An Conection With MS QUERY To A Csv And Query Data

Sep 6, 2008

I have a csv file on another drive on the network that i need to query. I believe that ms query would be the best way. I know that a DSN needs to be setup but this macro will be used by various users who wont know how to do that. thus I would like to create one via VBA every time the task needs to be run.
I haven't a clue how to do this and i need it to be explained to me in general terms with words of one syllable!

View 9 Replies


ADVERTISEMENT

Pass Parameter From Excel Through MS Query To MS Access Query

Nov 26, 2012

I have an MS Access query that contains a parameter. The parameter is a date field, and I have configured that in the Access query. If I run the query within the MS Access user interface, it prompts me for the paramater value as expected, and runs just fine. However, I want to connect to this query from within Excel as a data source.

I have created a connection to the Access file using ODBC from within Excel. In the MS Query window, I am merely selecting all of the fields resident in the MS Access query, and returning all values. In other words, there is no selection criteria in the MS Query. I have done this many times with Access queries that DO NOT contain a parameter, and everything works fine. However, in this instance, I need to pass a parameter through to MS Access in order for the query to run. At the moment, I get the "Too Few Paramaters...1 expected" error message. This makes sense, because I haven't figured out how to pass the paramater to MS Access.

Is there a way to structure this that does not involve VB code? If so, I'd love to know how. I have tried creating parameters in MS-Query with the same name, but although I get the prompt it doesn't connect with the Access query as the source for the parameter value.

If the solution requires using code, I'm good with VB Code in Excel...is there VB for Excel code that could make this happen?

Failing that, I guess there must be (I've seen a few in my search thus far) Access VB Code that can make this work. I'm very rusty using VB with Access, so this is my least favored solution. However, if this is the only option, keep in mind that I need to pass the paramater ultimately from a user who will initiate the process using Excel.

View 3 Replies View Related

Query Parameters Which Takes The Date From The Cell Into The Query

Mar 29, 2007

Need the query parameters which takes the date from the cell into the query. How should I modify my query if it needs to take the date from a cell?? The bold one date should be picked from one of the cell in sheet 2.

My query is this
WEB
1
http://fc-web-phl1-101.phl1:8090/gp/...runReport.y=12

Selection=15
Formatting=None
PreFormattedTextToColumns=True
ConsecutiveDelimitersAsOne=True
SingleBlockTextImport=False
DisableDateRecognition=False
DisableRedirections=False

View 2 Replies View Related

How To Create Web Query

Dec 28, 2012

I need to create a web query.

I have lot of post codes which needs to be checked in a web page and the output column needs to be updated in the spreadsheet.

Link: - Find UK Postcodes Inside a Radius

for example: - The post code WD18 1TB will be there in Excel Sheet this has to be copied and pasted in the link in column

Step 2 : Click on map OR Place radius by location name or postcode

and Step 1 : Radius should be updated as 10 and then the Draw Radius needs to be clicked. Then the output needs to be copied (in this case the output is: AL2,HA1,HA2,HA3,HA4,HA5,HA6,HA7,HP3,UB9,WD1,WD17,WD18,WD19,WD2,WD23,WD24,WD25,WD3,WD4,WD5,WD6,WD7) in our spreadsheet in the next sheet.

View 1 Replies View Related

Query An Access Query With VBA Function

Jul 8, 2008

I'm trying to query a query in Access 2003, from Excel 2003.

The query in Access looks like:
AccessQuery: [SELECT VBAFunction(field1) FROM Table]

The query in Excel looks like:
ExcelQuery: [SELECT * FROM AccessQuery]

I use the following VBA code in Excel to excecute the query:

With ThisWorkbook.Worksheets(cDataSheetName).QueryTables.Add(Connection:=strConnection, _
Destination:=ThisWorkbook.Worksheets(cDataSheetName).Range("A1"), Sql:=strQuery)
.RowNumbers = True
.Refresh BackgroundQuery:=False
iResultRowCount = .ResultRange.Rows.Count
End With
When I execute this code I get the error message 'SQL Syntax Error' (Error 1004). When I remove the VBA function from the query in Access, it all works fine.

View 9 Replies View Related

Edit Query Using Query Wizard

Apr 25, 2006

I created an Ms Excel Database Query to bring in data from MS Access. (versions 2002 of MS Excel and Ms Access). The query works fine initially. I can right click, choose Edit Query and change my criteria. Results are returned almost instantly.

My problem is that, once I save the workbook, or autosave happens, I get an error when I right-click to Edit Query: This query cannot be edited by the Query Wizard..

View 2 Replies View Related

Loop To Create New Worksheets, Name Them And Add Web Query

Jul 10, 2009

I have been trying to create new worksheets, name them and create webquery according to the input on table B4:C13 in test1 sheet attached (code is in module 1). After I run the code it stops after creating sheet with name 1 and shows error 1004. here it is the

View 8 Replies View Related

Create Query Of Mutiple Workbooks

Jul 27, 2006

I have a workbook that query's our case tracking database and pulls data into a csv. I am trying to write something that would do the following:

1) Prompt the user to enter in a case number
2) Open up the following file:
-"C:Documents and SettingsDetails.csv"
3) Look through A:A for a match of the user entered number
4) If a match is found then pull the data from cell B in that Row
5) Output the data (from row b)into a text box on the user form along with the original entry made by the user.

View 2 Replies View Related

Create Pivot Table Based On Union Query

Jul 2, 2010

I created a union query in Access to join two tables (Projections and Actual Sales). The query produces the results I want. I need to create a pivot table in Excel using the union query as the source. When I pull up the data import function in Excel, the union query does not appear. Do I need to do something else? I have tried to create a select query where I select all from the union query and I can find that fine.

When I use this query to create the pivot table the results end up all zeros when I try to sum the values. It creates some crazy results when I show it as count of also.

I can provide the data in either the Access database or Excel spreadsheet.

View 4 Replies View Related

Create SQL Query In VBA And Display Result As Table In Worksheet

Feb 3, 2010

I need the VBA script in excel that will do a SQL Query, for this case I need to select a value where there are 2-3 tags and between certain period then display the result as a table in a worksheet.

Example I have a database with 3 types of tags "Tag A", "Tag B", and "Tag C", and each tag have a value with different timestamp. the database looks like this:

No. Timestamp Tags Value
1 1-Jan-2010 Tag A 18
2 1-Jan-2010 Tag C 20
3 2-Jan-2010 Tag A 20
4 3-Jan-2010 Tag B 17
5 3-Jan-2010 Tag C 19
6 4-Jan-2010 Tag B 18
7 4-Jan-2010 Tag A 20
8 5-Jan-2010 Tag A 22
9 5-Jan-2010 Tag B 18
10 5-JAn-2010 Tag C 20

View 9 Replies View Related

MS Query - Parameters (parameters On A Query But Use A Wildcard To Return All Instances)

Nov 17, 2009

Is it possible to set parameters on a query but use a wildcard to return all instances? I have a query that I want to be able to set multiple parameters on but give the user the ability to select as many or as few parameters as they want to see. 2 of the parameters are number fields and 2 are text fields with no spaces.

View 4 Replies View Related

Lookup Query - Occurrences: Create Another Worksheet With The Months Of The Years Listed Down Column

Oct 16, 2008

I have a table that lists the months of the year down from cell A2:A13, and days of the week along row from cell B1:H1. The data in between (cell B2:H13) is pulled through from elsewhere in the workbook and is in number format.

What I basically want to do is create another worksheet with the months of the years listed down column A, and in column B, for each month, I want the first day of the week where the value in the original table is more than zero, and in column C the second day of the week where the value is more than zero. I really hope that makes sense, was quite difficult to explain!

View 2 Replies View Related

Edit Web Query - Get Data From Web

May 10, 2014

i have a worksheet that gets data from web - its automated, but the website goes through a tunnel - with security - requires username and password

the Query Runs ok and smooth but i have to login manually by right clicking on a table where the query is and selecting "Edit Query" so i can login, excel vba doesnt save passwords for that part...

one way i find it possible to automate that part too would be to use maybe like the sendkeys statement to pop up the context menu from right clicking the mouse button, or like the options button on the keyboard.

I found this one:

[Code] .....

It works but the context menu comes exactly from where the current mouse position is..

I needed it to do the right click on a specific range in the worksheet (where the web query is)..

View 8 Replies View Related

Pulling Data From Web Without Web Query

Mar 5, 2010

information from a website that does not allow web queries (or at least from Excel 2003).

I have to pull the latest data every Wednesday from this webpage: [url]

To make things even more complicated the name of the page changes every week as well (corresponding to the date).

View 9 Replies View Related

Data Validation Drop Down Query

Jan 12, 2010

Would anyone know if it is possible to extend the size of the list presented when using the data validation drop down? At present, it seems to default to 8 choices (even though there is a scroll bar) but I was wondering could the list Automatically display, say 20 choices?

View 3 Replies View Related

Web Query Data Into One Single Cell

Dec 30, 2008

I tried to import web data from a textarea (look at example2.jpg) into excel and it always end up squeezing all the information into one single cell(spreadsheet.jpg).

I am trying to find a way to edit the imported data which is similiar to paste special or extract the information from the cell into a table, but I seem to waste a lot of time on this and going no where.

View 4 Replies View Related

Save Old Data When Web Query Refreshes

Jun 27, 2009

When the data is refreshed, how can i keep the previous data and use it in a graph that automatically updates?

View 12 Replies View Related

Returning Data From Microsoft Query

Sep 7, 2009

I have a query which is giving me some trouble when returning the data from ms query. The query was written in mysql query browser and returns 2 columns of data - a date and a number. MS Query correctly processes the query but when the data is returned to excel only the second column is returned. Here is the query:

SELECT
(SELECT
max(l.the_date)
FROM
nc_view_date_functions AS l
WHERE
l.week_of_year = d.week_of_year
AND l.yyyy = d.yyyy
) AS week_end_date,
count(r.consent_id) AS weekly_count
FROM
rg_resource_consents AS r
INNER JOIN nc_view_date_functions AS d
ON r.application_date = d.the_date
GROUP BY
d.yyyy, d.week_of_year;

View 2 Replies View Related

Data 'is Not Number' Character Query

Oct 5, 2009

They have a list of data numbers which are yy/#####/@@@@@ (2digit year/casenumber/alphanumeric code). Where some people have typed in the code wrong (6 or more digits in case number) we want to know is there a way of doing this.

Ideally I want something that says "If 9th character is a slash then yes, if not no" or "if 9th character is a number then yes, if not, no".

Example of data is (where we want third option highlighted as erroneous (6 not 5 numbers in middle)

09/56487/KFJT
09/42105/PLOUR3
09/002145/PLIFD
09/02145/ASDF

View 4 Replies View Related

Find Data That Matches Query

Nov 9, 2008

I have a spreadsheet with 3 columns: Name, Number and percentage. I need a formula to return the name that has the percentage and the 2nd highest percentage. the spreadsheet has 5 rows, not including the columns labels.

View 2 Replies View Related

Identifying Numeric Data With MS Query

Dec 6, 2006

I am trying to slim down my database results in Excel via MS Query by searching for Part ID's that are numeric (we have parts that also contain letters....I want to weed those out).

In all my searching on the web, I thought the ISNUMERIC() function should be the function for this, but I keep getting an ORA-00904::"ISNUMERIC":invalid identifier....

Is this function supposed to work or is there another function that will do this

This is my SQL statement so far, which works to get parts that are 6 characters long only:

SELECT PART.ID
FROM SYSADM.PART PART
WHERE (LENGTH(PART.ID)=6)
When I change it to this to get parts that are numeric, it gives the error above:

SELECT PART.ID
FROM SYSADM.PART PART
WHERE (LENGTH(PART.ID)=6) AND (ISNUMERIC(PART.ID)=1)

View 9 Replies View Related

Extracting Data From Access With SQL Query

May 10, 2009

I have been trying to pass a query to fetch data from Access database.

The query is:

sSQL = "Select Client+, Entry-ID, Type of Contact, Manual Creation, Date Created, Transfer-date, Respond SLA FROM BASE DATA"

The problem I am facing is in:

rst.Open Source:=sSQL, ActiveConnection:=cnn, _
CursorType:=adOpenDynamic, LockType:=adLockOptimistic, Options:=adCmdText

The error I am getting is:

Run-Time error '-2147........'

Method 'Open' of Object '_Recordset' failed...

View 39 Replies View Related

Copy Data From Web Query To A Table

Jun 26, 2006

I use web query to get some range of data. This data is refresing and changing on some time (i set query refresh on 1 minute). So, i'd like to fetch this data and make the table with all data (new data on eg. every 1 minute). How to do this?
I use Excel 2003.

View 2 Replies View Related

Data Source For Msquery Query

Nov 16, 2006

I have inherited a file that calls an Access database via Msquery. I can see the query that is being used with:

Data | Import External Data | Edit Query | Query Wizard

How can I determine the Access database that the query is using for its data source?

View 6 Replies View Related

Pull Data By Using New Webbased Query

Mar 4, 2007

I am trying to pull data using New Webbased query. But when I try pasting the link it is promping me that the string is very large.

View 3 Replies View Related

Database Query Does Not Return Any Data

Mar 15, 2007

I am using the attached code however when my database query does not return any data I dont want the Dim function to perform.

Sub macro3()
Worksheets("Data 1"). Range("I3:BU65536").ClearContents
'declare a variable to hold date
Dim strDate As String
strDate = Format(CDate(Range("startDate").Value), "yyyy-mm-dd") & " " & FormatDateTime(CDate(Range("startDate").Value), vbLongTime)
Sheets("Data 1").Select
Range("A1").Select
With Selection.QueryTable
.Connection = _...........................

View 4 Replies View Related

Data Sorting Query - Get Excel To Calculate?

Feb 10, 2013

I am a teacher and have a recurring problem when trying to sort data in excel. The problem involves national curriculum sub levels. For those not familiar with these levels, there is a main level then 3 sub levels. The problem is that they are counter intuative to the way excel sorts data. The sub levels work like this:

4a - highest
4b
4c
3a
3b
3c
2a
2b
2c - lowest

There are lower and higher levels, but you get the idea. If I have a set of pupil data that I want to sort into decending order, I find it difficult in Excel. E.g.

Jacob2c
Mary3b
John2a
Sally2b
Sarah2b
Joe3a
Bill3a

If I manually sort the above data into descending order of national curriculum level it will look like this:

Joe3a
Bill3a
Mary3b
John2a
Sally2b
Sarah2b
Jacob2c

but if I try to get excel to do it, obviously excel just treat the levels as alpha numeric and sorts them like this:

Mary3b
Joe3a
Bill3a
Jacob2c
Sally2b
Sarah2b
John2a

I know there must be an easy way involving creating a custom list, but I don't know how to do it.

Problem 2

A related query involves finding a way to get excel to complete the data in the Sub levels progress required column below:

NameLevelTargetSub levels progress required
Mary3b4a
Joe3a4a
Bill3a4a
Jacob2c2a
Sally2b3c
Sarah2b3c
John2a3a

At the moment I manually complete this. E.g. for Mary the Sub levels progress required would be 4, as there are 4 sub levels between 3b and 4a. For Joe it would be 3 as there are 3 sub levels between 3a and 4a, etc. Is there a quick way to get excel to calculate this.

View 6 Replies View Related

Excel Web Query Is Returning Blank Data?

Jun 23, 2013

I am trying to get data in excel sheet using web query from the following web link:

But I the data returned is a 'hypen' (i.e. a dash symbol). I am getting the row/column headers but not the figures or the numbers under them.

View 2 Replies View Related

Returning Data From Microsoft Query To Excel?

Jun 23, 2013

I am trying to use queries I have been running in MS SQL Server Management Studio, to return data in Excel where it would display as pivot. Some queries I was able to use through Excel but few others are not returning anything.

I am doubting it has something to do with the query itself - but they are displaying results properly in MS Query, they are just not returning any data to Excel.

View 3 Replies View Related

Excel 2003 :: Web Query - No Data Has Been Found

Sep 20, 2013

I am trying to set up a spreadsheet in Excel 2003 that pulls data from a lot of different websites and formats it all for me. I have managed to do this with a few websites but there are two which I'm having problems with.

This is the table I am trying to get, but when I do a manual web query and select the table and click OK, it says that no data has been found.

[URL] ...

View 1 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved