Home |
Search |
Today's Posts |
#9
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks for all your help. Sorry for the delayed response..
Have a great day! " wrote: Yo Candyman, Yeah, once you're on board with DAO you'll wonder why you ever used MS Query .... I am getting a "User defined type not defined" error with the line: Public Function GetConnection(db As DBConnection) As ADODB.connection highlighted You have to determine if Excel can't find DBConnection or ADODB. 1. Confirm that you post the DBConnection information into a class module.(In your project you should have MS Excel Objects, Forms,Modules, Class Modules (and DBConnection should be a Class Module). 2. Confirm that Excel is referencing "Microsoft DAO 3.6 Object Library" or so 3.51 - whatever version you've got. I am trying to run a test macro but I am not sure how to envoke the 'db' part of your function using: Try: Public Function GetConnectionInfo() as DBConnection Dim db as New DBConnection db.server = "yourserver" db.database = "yourdatabase" db.userName = "yourusername" db.password = "yourPassword" Set GetConnectionInfo = db End Function Sub test() Dim str, book, WSname , myDb As String Dim myDB as DBConnection Dim x as Integer myDB = GetConnectionInfo() book = ActiveWorkbook.Name WSname = "TEMP" SQL = "select * from HEIDS.HE_ACAPS_LOCS" x= SelectData(book, myDB, SQL, WSname) End Sub |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
If part of a cell = "NVA" then insert "Norfolk" in return cell | Excel Worksheet Functions | |||
Nested If Statement "FALSE" Return | Excel Worksheet Functions | |||
Excel If statement that is supposed to return a "" instead returns a 0 | Excel Worksheet Functions | |||
Return blank for true "if" statement when charting, not 0 | Charts and Charting in Excel | |||
Insert "-" in text "1234567890" to have a output like this"123-456-7890" | Excel Discussion (Misc queries) |