sql - how to get input into an Jet OLE DB Query -
Background:
I am using Excel 2003
I have 2 Excel The files are (source, list), one essentially my source data. Second is where I am using excel "import external data" to get data in the second sheet. I am then using modified query so that I can use SQL for the query of my data and limit the data I am displaying.
My SQL query:
SELECT * ['master list $'] where [name] is like "brent%";
My question is, I have to have cell A1 an input in my query. So in A1, I have to "brent" to change the first WHERE
condition.
I hope to find something that I change to a cell and
Anyone have an idea?
Thank you.
My connection string is:
Provider = Microsoft.Jet.OLEDB.4.0; User ID = Admin; Data source = C: \ My data \ Master list \ Master list. Xls; Mode = share prohibition; Extended property = "hdr = yes;"; Jet Olendi: System database = ""; Jet Olendi: Registry Path = ""; Jet Olendi: Engine Type = 35; Jet Olendi: Database Lock Mode = 0; Jet Olendi: global partial bulk ops = 2; Jet Olendi: Global Bulk Transactions = 1; Jet OLEDB: New Database Password = ""; Jet OLEDB: Create System Database = Incorrect; Jet OLEDB: Encrypt Database = Incorrect; Jet OLEDB: Compact = Do not copy Locale on Local; Jet OLEDB: Compact Without Replication Repair = Wrong; Jet OLEDB: SFP = False
You accidentally created FROM
Keywords in your query.
Because you are asking for an Excel workbook, it is best to ensure that it is turned off; You should be aware of using wet DB as well Also, know how Excel determines the type of data, which can be a little strange with the NULL
s appearing unexpectedly; More info on
You have not specified a worksheet, so I assume that it has been named Sheet1
.
Your too many connection strings have been created; Default values can be removed and deleted.
Because it is a programming site and you are asking about Excel, about some VBAs How to:
sub-excel exploration () Const CONN_STRING string = _ "Provider = Jet as Microsoft. OLEDB.4.0; User ID = Admin;" & Amp; _ "Data Source = C: \ My Data \ Master List \ Master List. Xls;" & Amp; _ "Mode = write share prohibition; expanded properties =" "HDR = yes;" ";" & Amp; _ "Jet Olendi: System Database =" "" Jet Ondi: Registry Path = "" ""; " & Amp; _ "Jet Olendi: Engine Type = 35; Jet ALLDB: Database Locking Mode = 0;" & Amp; _ "Jet Olendi: global partial bulk ops = 2;" & Amp; _ "Jet Olendi: Global Bulk Transactions = 1;" & Amp; _ "Jet Olendi: new database password =" "" ";" & Amp; _ "Jet Olendi: create system database = false;" & Amp; _ "Jet Olendi: encrypt database = false;" & Amp; _ "Jet Olendi: Compact = Do not Copy Locale on Fail;" & Amp; _ "Jet Olendi: Compact Without Replication Repair = Wrong;" & Amp; _ "JetLLDB: SFP = False" "SQL_act String as Structure = _" Select * From ['Master List Dollar'] Where Is [Name] Like? "CMD Set CMD = Create Object (" ADOB. Command ") with CMD. Active Connection = CONN_STRING. COMMAND TEXT = SQL_ITIR DEAM PARAM SET PARAM = Object (" ADODB.Pamator ") with Ultimate Direction = 1 'Adapter Input. Type = 202 'adverkey size = 255. Features = 64' adParamNullable.value = thisWorkbook.Worksheets ("Sheet1"). Range ("A1") with value and "%" end. DM RS Set RS = Create Android with Object ("ADODE Rebecca ") with RS set. Source = CMD.Open 'Record with accessories ... End with End & End
UPDATE
Which parts of the connection string are useless? To a great extent! For example, the default user is the administrator but the Jet Workgroup file is an empty string because Excel does not use Jet security. I think the connection to Connection string without changing Programming can be reduced to:
in CONN_STRING string as String = _ "Provider = Microsoft.Jet.OLEDB.4.0;" & Amp; _ "Data Source = C: \ My Data \ Master List \ Master List. Xls;" & Amp; _ "Extended Properties =" "HDR = Yes;" ";"
Comments
Post a Comment