I am trying to send an SQL query string from Excel VBA to an access database. I have a standard module for this and it works fine except when I am trying to get this query to run.
sSQL = SELECT SV_CgRefset.Name FROM SV_CgRefset WHERE ((SV_CgRefset.Name) = "CKD_15");
In short this gets to the...
Hi. I have recently been upgraded to Office 365 64-bit and I have noticed that the ADO commands for updating data in a SQL Server database are dramatically slower... paticularily in a large (ish) spreadsheet. This simple code example below connects to a SQL Server database and updates a single...
I am trying to clear the contents of a table in Access from Excel, using VBA.
This code works:
Option Explicit
Sub DeleteDataUsingActiveX()
Dim MoviesConn As ADODB.Connection
Set MoviesConn = New ADODB.Connection
Dim MoviesCmd As ADODB.Command
Set MoviesCmd = New...
Having an issue trying to debug someone's work, don't know this style of coding well and so not sure what is wrong here exactly but the error it says is user-defined type not defined, and I tried fixing this by defining it as a different declaration and that didn't work.
' Connect to the...
The access database is not opened. How can I change this VBA code to open the access database.
The code doesnt crash so I think the access database is opened in memory!
Sub copydatabase()
Dim jobconn As ADODB.Connection
Set jobconn = New ADODB.Connection
jobconn.connectionstring =...
Hi all,
I am having trouble in the below code its keep getting me error on line
rst.Fields(Cells(1, i).Value) = Cells(x, i).Value
i dont know what the problem is please help me out.
the complete code is here
Sub Export_Data()
Dim cnn As ADODB.Connection
Dim rst As ADODB.Recordset
Dim dbPath...
Hi,
I am completely stuck on this one, any help will be appreciated.
I have a code which is supposed to do inserts/updates in database. I have connected to database using both (one commented out):
Sub SQLConnection()
Dim oConn As ADODB.Connection
Set oConn = New ADODB.Connection...
Hi everyone,
I have userform and transferring some data to closed excel files. This data collecting in MS Access mdb database and I want to protect this. I found a string from the net and I connect unprotected my mdb file successful. These codes are below but I don't know how can I connect my...
I find an easy way to send data from excel sheet to access database with following VBA code :
Sub SaveOnAccess()
Dim NewCon As ADODB.Connection
Set NewCon = New ADODB.Connection
Dim Recordset As ADODB.Recordset
Set Recordset = New ADODB.Recordset
NewCon.Open...
HI ALL, FIRST OF ALL, SORRY ABOUT MY ENGLISH, IM NOT AMERICAN.
I HAVE AN ADODB.CONNECTION, FROM I QUERY DATA USING AN ADODB.RECORDSET, SO I ADD A QUERYTABLE TO PASTE THIS DATA ON MY SHEET USING REFRESH.
I HIGHLY WANT THAT THIS QUERYTABLE REFRESHS ALONE, SO THE DATA IS UPDATED WITHOUT THE NEED...
I am new to excel VBA. I have a requirement where I have to copy table values from sql server 2005 to an excel worksheet. I have googled and written a code for the above requirement (listed below).
In this excel sheet there are fixed set of rows which displays legends and dates. These rows...
Hi all,
I am trying to use ADODB connection stuff to read and copy data from a closed book.
The code will look for an excel file, read and copy the data into the sheet "PnL_T-1". Generally the macro will read the file dated as of yesterday (Date1), but sometimes I will need the macro to read...
I am running the same query from crystal reports and excel vba.
The crystal reports runs in about a second.
Excel VBA takes 26 seconds.
They both are going through the same ODBC connection.
The query comes directly from crystal reports > Database > Show SQL query
The vba code is simple...
Working in Access 2007 and Excel 2007....
I have an .accdb (WellCardPilot.accdb) that pulls information from multiple tables (some linked, some built into the DB). The following code works fine to return all records from a query called BridgeportWellCard to a specific worksheet in Excel (Sheet...
We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel
Which adblocker are you using?
Disable AdBlock
Follow these easy steps to disable AdBlock
1)Click on the icon in the browser’s toolbar. 2)Click on the icon in the browser’s toolbar. 2)Click on the "Pause on this site" option.
Go back
Disable AdBlock Plus
Follow these easy steps to disable AdBlock Plus
1)Click on the icon in the browser’s toolbar. 2)Click on the toggle to disable it for "mrexcel.com".
Go back
Disable uBlock Origin
Follow these easy steps to disable uBlock Origin
1)Click on the icon in the browser’s toolbar. 2)Click on the "Power" button. 3)Click on the "Refresh" button.
Go back
Disable uBlock
Follow these easy steps to disable uBlock
1)Click on the icon in the browser’s toolbar. 2)Click on the "Power" button. 3)Click on the "Refresh" button.