Edit Stored Procedure Query

Jan 30, 2009

I am using the following code to run a Stored Procedure Query. It works perfect bringing back 4 columns of data. But is it possible to make it so that it only brings back 2 columns of data. I need the 2nd and 4th, which are named "DateOf" and "Gen", respectively. Someway to include a select command?

I posted here, without luck: http://www.mrexcel.com/forum/showthread.php?t=367809

View 2 Replies


ADVERTISEMENT

CALL STORED PROCEDURE FROM VB

Feb 12, 2009

I need to call a Stored Procedure in a SQL Server from VB, but do not have the minimun Idea about doing it....Could you help me ?...I made a lot of attemps copiying code from other treads and scratch it, but so far results = none.

Server name: VAIO/SERVIDOR
DataBase: CEDRO
I´m using Excel XP.

View 9 Replies View Related

SQL Server Stored Procedure Via VBA And ADODB

Feb 13, 2013

I'm creating my first stored procedure ever and it looks relatively good so far. The problem is with passing the parameters, more exactly:

Arguments are of wrong type, are out of acceptable range, or are in confilict with one another

The essential part of the stored procedure looks like:

Code:
CREATE PROC GetUserAuthForApp
@User varchar(7),
@application int
AS

while the essential code calling it from VBA looks like:

Code:
Dim strConn As String 'Connection string to SQL Server
Dim strSQLtoExecute As String 'SQL query string to execute
Dim oConn As ADODB.Connection 'Object for connecting
Dim rs As ADODB.Recordset 'Object for recordset
Dim cmd As ADODB.Command
Dim prmUser As ADODB.Parameter
Dim prmApplication As ADODB.Parameter
Dim stProcName As String 'Stored Procedure name

[code]....

and in that rs.Open comes that error.

What have I done wrong, how do I fix it?

View 9 Replies View Related

Calling Stored Procedure And Pass Through A Paramter?

Apr 27, 2007

Is it possible to call a stored proc from excel and pass through a paramter?

If it is would anyone have a clue how to do this?

View 11 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

Returning Header Row From Access Stored Query?

May 5, 2014

this example runs a named query in Access but it does not return the header row, just the data.

Code:
Sub RunAccessStoredQuery()
Dim objMyConn As New ADODB.Connection
Dim objMyRecordSet As New ADODB.Recordset
Dim strSQL As String

[Code].....

View 1 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

Excel 2007 :: Edit Query From Spreadsheet

Apr 11, 2012

I have recently installed excel 2007 how do you edit and ODBC query from the spreadsheet. In 2003 you right clicked on a cell that opened a dropdown where you selected edit query.

View 1 Replies View Related

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

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 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

Where Are Macros Stored

Jun 30, 2006

Where are Macros stored? Are they stored just in the worksheet, or are they stored locally on the machine?

View 3 Replies View Related

Stored Procedures Within Excel

Oct 3, 2013

MS Query can only hold 16 joins and some other restrictive requirements. Has utilized Stored Procedures to execute a query and have the results returned to Excel? Query in Excel seems very limited.

View 2 Replies View Related

Call Stored Macro

Jul 6, 2009

Any way to actually execute a macro stored as a text file?

Without being long winded - I want to create different macro and physically save them as text files. Once saved - I could call them from a list.

View 9 Replies View Related

Files Stored In An Array

Feb 17, 2010

I'm trying to open multiple files, pass them into an array and then work on them but the code below doesn't work (receive a Run-time error '9' message)

Public aFile As Variant

Sub MultipleFiles ()

MsgBox ("Please select multiple book files (holding CTRL as you click on flies) before you click open")

aFile = Application.GetOpenFilename(FileFilter:="Excel (*.xl*), *.xl*", _
Title:="Select required book level files", MultiSelect:=True)

Dim i As Integer

For i = LBound(aFile) to UBound(aFile)
Workbooks(aFile(i)).Activate
'Do something, then repeat with next file in array
Next i

End Sub

View 9 Replies View Related

Using Workbook Name Stored As A Variable

Jul 27, 2006

I am opening a workbook using a macro. I need to run a macro in the workbook I am opening when it opens. I have created a variable containing the workbook name but don't know how to use it to run the macro.

Dim WBName
WBName = ActiveWorkbook.Name
Application.Run _
"'DIST_91094_EDTABS_DIABETES CARE_07072006.xls'!aStartProcess"

'DIST_91094_EDTABS_DIABETES CARE_07072006.xls'! needs to be replaced by the name stored in WBName

aStartProcess is the name of the macro in that workbook I want to run.

View 9 Replies View Related

SUMIFS And Numbers Stored As Text

May 5, 2014

I do have the following problem:

When I use the SUMIF(S) function and a criteria range that has numbers stored as text (eg: '394) the unequal operator (<>) doesn't work.

=SUMIFS(B:B,C:C,"<>493") doesn't work

I'm able to get the salary of employee 493 by using "493" instead of "<>493", but it seems that with the unequal operator Excel starts treating this ID as number. The only work-around I found so far is to use a wildcard e.g. "<>*493" or "<>493*". Excel then treats it as text again, but this is dirty workaround. What happens if an employee with an ID e.g. 1493 shows up!?

"<>'493" or something doesn't work unfortuantely..

Employee ID

Salary

'250
10000

'493
13000

View 14 Replies View Related

Delete A Row Based On A Date Stored Within It

Jan 19, 2012

I have a table that extends from A1 to S630 (the number of rows changes as records are added and deleted).

The function to add rows based on the date is fine and I have implemented, but I cannot figure out how to delete a row based on a date.

The date is entered on a sheet called Calendar in Cell J20

so Sheets("Calendar").Range("J20")

and the date is in column B of the table, which has been made using the Table function

Is there a way of scanning through the whole table deleting all the rows with the date entered into J20 on the calendar sheet.

View 5 Replies View Related

Converting Number Stored As Text

Mar 12, 2012

I have a spreadsheet which has over 30,000 records. One column is a row of numbers stored in a General format. Some of these numbers are however stored as Text and have the following Error Check:

"The number in this cell is stored as Text or preceded by an apostrophe"

As a result, when I try to import this sheet into Access, the numbers are not imported and appear as blank cells in the Table.

Is there a way either manually or programatically, format the column so all cells in that column are stored as a number and do not have the issue of being stored as text?

View 4 Replies View Related

Launching A Macro That's Stored In A To Be Opened

Nov 15, 2007

Sub test12()

Set wbABC = Workbooks.Open("C:ABCwithMacro.xls")
Call abcMacro 'this macro is stored in ABCwithMacro.xls
'error - sub or function not defined on 'call abcMacro'

End Sub

View 9 Replies View Related

Find Spaces In Stored Data

Aug 13, 2008

I have a spreadsheet with data and I need to find text with spaces in one of the columns. How do I do that?

View 9 Replies View Related

Retrieving An Array Which Has Been Stored In A Workbook Name

Apr 7, 2007

I've successfully saved an array of string to a workbook name. How do I get it back out as an array of strings instead of as a "Variant/String"?

View 4 Replies View Related

Sort Numbers Stored As Text Not Working?

Sep 17, 2013

In a spreadsheet I have a text column with entries such as:
2012
10 Times
10.5 Times
101 Times
25 Times
A Pure Text Entry

When I sort by this column I expect to get:
10 Times
10.5 Times
101 Times
2012
25 Times
A Pure Text Entry

Instead I get the 1st order. Why? I've selected 'Sort numbers stored as text' separately so it shouldn't be treating 2012 as a number. Besides I've checked & the cell formatting is Text.

View 3 Replies View Related

Using Data Stored In A Variable To Draw A Shape

Jun 18, 2014

I have some code, in one part of it I am storing a number (between 1 and 8) as Integer. Is it possible to reference this variable to draw some rectangles on a sheet, sort of

"If MonitorDetail (this is the name of the variable) .value = 2 then

Here I place the code to draw the rectangle on the page. The macro currently stops at Monitordetail with a error telling me its a "Invalid Qualifier".

View 1 Replies View Related

Excel VBA Input Box Incorrect Data Being Stored?

Aug 1, 2014

I just want to ask the user to enter the date in a mm/dd/yy format, however, the date received is some how changing.

For example I execute the following code and get 8/01/14 instead of 8/21/14

[Code].....

I have even tried pulling the date from a formatted cell with no luck.

View 5 Replies View Related

Excel 2010 :: Numbered Stored As Text?

Dec 6, 2011

I received one excel spreadsheet office 2010 every week from one on the vendor. it has over 55000 rows. I got columns N, O, P & Q. these columns has some value which I use for my pivot tables. However the values in this columns are stores as a text. I select the little small box (information box ) appears on the right side of the cell and right click on that where I get an option to change it to number. This is working well.

However I have over 55000 rows , it takes a lot of times to change all these cells in four columns ( almost over 220,000 cells). some times more than an hours.

I use excel 2010.

View 3 Replies View Related

Using EXCEL Formulas With Data Stored On MS ACCESS?

Jun 5, 2013

I am trying to find out if it possible to directly "access" (no play on words here) data stored on MS ACCESS by using Excel's formulas.

I have a set of tables stored on a Microsoft ACCESS 2010 database, and I want to use Excel to analyze that data, using formulas, such as SUMIF.

Is it possible, once I have established an Jet OLEDB connection from Excel to Access, to then directly exploit the data stored on Access without having to copy the data to Excel, and then use it.

I would like Excel to solely act as a tool to analyze, not to store data.

View 7 Replies View Related

VBA To Import Access Database Stored On SharePoint

Jun 14, 2013

How to import data from an access database, specific tables, to excel using vba; the trick being the database is stored on SharePoint Server 2010.

View 2 Replies View Related

Macro To Calculate Formulae Stored As Text

May 8, 2008

I would like a macro which works on the selected cells:

A number of the selected cells contain formulae with an apostrophe in the beginning.

I need the macro to remove the apostrophe and calculate the formula in those cells..

View 9 Replies View Related







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