strsql

  1. P

    Excel quitting for some unknown reason - doesn't even prompt about saving

    Hi A problem that's only started happening on my spreadsheet in the last couple of months. I've got some VBA that works fine if I sit there and watch it.....it does everything it should. It finishes all of its loops and Excel stays open as it should. Whereas if I don't sit there watching for...
  2. P

    ADO %, * Wild Card confusion

    Hi I've found the workaround for this issue, but don't understand why it was an issue: I did all the hard work of writing the queries in Access and some of the queries involve sub-queries e.g. Pretend I wanted queries that prepared data on Goals, Assists, Wages, Corners So inside Access, the...
  3. R

    Help with VBA SQL recordset

    Hi Guys and Girls. I just have a quick question. My VBA knowledge is ok, however I am not very good at programming with SQL. I have a piece of code which works fine. It is just that it is not robust, I have created a loop with an string and open an recordset at the end of my loop I close...
  4. R

    Server Prinicipal Security Error

    Greetings I am trying to extract data from SQL Server using Excel VBA. Below is the code which errors out @ the Rs.Open StrSQL, Con Sub DbConnection() Dim Con As ADODB.Connection Dim Rs As ADODB.Recordset Dim Fld As ADODB.Field Dim StrSQL As String Dim Wb As ThisWorkbook Dim Ws As Worksheet...
  5. H

    Query .csv File

    Hi All, I am trying to query csv files to extract some fields and filter the records and return the resulting recordset to a new csv file. I have adopted two sets of codes by finds it difficult to accomplish the above Sub GetMyCSVData() Dim xlcon As ADODB.Connection Dim xlrs As...
  6. The_Kurgan

    Missing reference in Excel 2016

    I do a lot of automation between Excel and Access. Unfortunately, I’ve been switched to Excel 2016 and am now missing the “Access Developer Extensions Type Library” reference. Below is just a sample piece of code I would use that is now puking due to the missing reference. Has anyone found a...
  7. T

    why won't "Dim rs As DAO.Recordset" compile

    I am a novice so I apologize if this is a dumb question. Long story short. I am trying to combine multiple records in a query. I have an ID field and a field of names of diagnoses. My goal is to have one row per ID with the diagnoses combined in one field. Everything I read on line says...
  8. C

    Access VBA - 'On Error' Send Email Help

    Hi, I have the below code that picks up a file based on the contents of a Excel range. However, there will be occasions where a file won't be present. On these occasions I want the code to ping an email to me to let me know. As it stands, the below is sending me 3 emails rather than 1, can...
  9. C

    Access VBA - 'On Error' Send Email Help

    Hi, I have the below code that picks up a file based on the contents of a Excel range. However, there will be occasions where a file won't be present. On these occasions I want the code to ping an email to me to let me know. As it stands, the below is sending me 3 emails rather than 1, can...
  10. R

    User Login

    I broke my new user login form. I removed the uLogonCount from the tblUsers and from the below strSQL code and now whenever the New User form comes up I get the following error; Number of query values and destination fields are not the same. I also added a few columns to the tblUser table. So...
  11. R

    Syntax/End Statement Error

    Good day everyone. Used a code for a login form and it doesn't seem to be computing whatsoever. Private Sub cmdContinue_Click() On Error GoTo ErrHandler Dim strSQL As String If Nz(Me.txtFirstName, "") = "" Then MsgBox ("First Name cannot be empty.") DoCmd.GoToControl...
  12. J

    Need help importing new data into current spreadsheet

    Hello I know it a lot of code but im keep getting stuck on the bolded area below and I cant figure out why. I am trying to bring in new data but I keep getting an error. Can someone please assist? Option Compare Database Option Explicit Function ImportAchievers() Dim strSQL As String...
  13. E

    VBA SQL Statement failing after 2016 MS Office Update

    I have a sql statement that my vba queries against itself. This has been working just fine and is properly set up. Since I updates my MS Office and now have 2016 Excel I am getting a Runtime Error ODBC driver does not support the requested properties. strSQL = "SELECT DISTINCT...
  14. The_Kurgan

    Excel VBA Joining Tables on Different Servers

    I realize this is probably a long shot, but would anyone have sample VBA SQL code where you're joining tables from different servers? I've done a lot with pulling data from tables on one server, but not more. TIA For some frame of reference only, this is some sample code where I'm adding...
  15. T

    VBA Update Command Text in OLEDB Query

    Excel 2016, I have an OLEDB Query linked to SQL Server to return a table. In prior versions I was able to update command text and refresh the table with the following: Dim strSQL as string strSQL = worksheets("SomeWorksheet").Range("B6") With...
  16. J

    vba code to retrieve data from sql database

    Hi, I am getting the following error message and am not sure how to get rid of this. 'Run-time error - 2147467259 (80004005): Method 'CopyFromRecordset' of object range failed. The VB code is as follows: Sub GetDataFromSql() Dim conn As New ADODB.Connection Dim rs As ADODB.Recordset Dim...
  17. M

    Connect to spreadsheet Help

    Hi All, I have reperative code which I am trying to sort but can't seem to crack it. What I am trying to do is put SQL in a sub and then make it connect to a seperate excel sheet. At the minute I have to put the connect code in each module so is in about 5 times. Is there anyway to just have...

We've detected that you are using an adblocker.

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.
Go back
Back
Top