ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   SQL query (https://www.excelbanter.com/excel-programming/408453-sql-query.html)

Rolf G

SQL query
 


Hi
I try to use this qurey
szSQL = "SELECT * FROM [Blad1$] WHERE A = 1"

and it works fine if I don't use "WHERE A = 1"

Another question is how to do if I want to do somthing like this

SELECT A FROM [Blad1$]

Is it possible?

Sorry for my bad english

Ragards Rolf



*** Sent via Developersdex http://www.developersdex.com ***

MarkS

SQL query
 
Hi,
The query will work so long as the syntax is correct. You will need to put a
on error
clause in to trap the error you will get if it returns zero records. I use
this

On Error GoTo ErrorChecker:

ErrorChecker:
' EOF Error
If Err = 3021 Then
rsADO.Close
** Do Something **
End If
Else
MsgBox (Err & "Error")
Stop
End If

"Rolf G" wrote:



Hi
I try to use this qurey
szSQL = "SELECT * FROM [Blad1$] WHERE A = 1"

and it works fine if I don't use "WHERE A = 1"

Another question is how to do if I want to do somthing like this

SELECT A FROM [Blad1$]

Is it possible?

Sorry for my bad english

Ragards Rolf



*** Sent via Developersdex http://www.developersdex.com ***



All times are GMT +1. The time now is 05:10 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com