Skip to content
Advertisement

Tag: excel

Excel SQL VBA: adding more than one cmd parameter

I am writing SQL-query, and I get error with string value: I tried to add more than one cmd parameter to solve this problem: But I also get an error. How do I set more than one cmd parameter and use it in my query? Table I am working with: here. Answer The parameter to CreateParameter are The Direction –

Sql string with OLEDB gives error 1004 in VBA

I would like to import a text file into excel filtering just what I want through a VBA macro. When I use LIKE operator in the sql string I get the error 1004. I have tried both * and % as wildcard and ALike instead of Like but there is no difference. test_7.txt and the macro is: Answer SQL statements

Adding parameter to SQL query

I want to get some data from Excel table using SQL-query inside macros. My code is: If I try using sql = “SELECT * FROM [Page 1$] WHERE Job = 2”, I have no errors. How could I paste Value2 and Value1 values inside my SQL-query? Answer Try like this

Reading Excel file with SQL returns null due to empty column

I am attempting to read in an Excel File from a third party but it falls over and returns null due to empty column. The file has 50 columns, a blank column and a further 48 columns. I only want the first 50 columns. If I delete or populate the empty column in Excel it works but I need to

Populate listbox from access file

I have found a piece of code that enables me to list or populate listbox based on access database When trying that I encountered an error Type data mismatch in criteria expression at this line rst.Open strSQL, cnn, adOpenKeyset, adLockOptimistic, adCmdText Answer Your table got a field related to a secondary table (let’s say it’s called tblGender). If the primary

How to retrieve data from other Excel using VBA and SQL?

I have a problem with my code. I tried retrieving data from other Excel file. My code works but I received full data in one cell (A1). I’m sorry but I’m just beginner, believe that’s the problem related to output, but I’m not find out why: Answer No need to wrap recordset values wtih semicolon delimiters using a Do loop.

Advertisement