mrmotocross
Programmer
hello, I am having a problem with an sql statement. Below is the code i'm using:
Query6 = "SELECT * FROM EmpDetail where Activity = '" & HoldActivity & "' ORDER by Activity, Date;"
Select Case ReportNumber
Case 0
SQL = Query1
Case 1
SQL = Query2
Case 2
SQL = Query3
Case 3
SQL = Query4
Case 4
SQL = Query5
Case 5
SQL = Query6
Case 6
SQL = Query1
Case 7
SQL = Query7
Case 8
SQL = Query8
Case Else
Debug.Print " "
End Select
Dim QryConn As New ADODB.Connection
QryConn.ConnectionString = NesConnString
QryConn.Open
Dim QryRst As New ADODB.Recordset
Dim QryComm As New ADODB.Command
QryComm.ActiveConnection = QryConn
QryComm.CommandText = SQL
QryComm.CommandType = adCmdText
Set QryRst = QryComm.Execute
QryRst.MoveFirst
On the execute i receive 'bof or eof encounterd' or therefor it is not finding any records. If i use a sql statement using 'select *' it works fine. What am i doing wrong?
Thanks, liboy1
Query6 = "SELECT * FROM EmpDetail where Activity = '" & HoldActivity & "' ORDER by Activity, Date;"
Select Case ReportNumber
Case 0
SQL = Query1
Case 1
SQL = Query2
Case 2
SQL = Query3
Case 3
SQL = Query4
Case 4
SQL = Query5
Case 5
SQL = Query6
Case 6
SQL = Query1
Case 7
SQL = Query7
Case 8
SQL = Query8
Case Else
Debug.Print " "
End Select
Dim QryConn As New ADODB.Connection
QryConn.ConnectionString = NesConnString
QryConn.Open
Dim QryRst As New ADODB.Recordset
Dim QryComm As New ADODB.Command
QryComm.ActiveConnection = QryConn
QryComm.CommandText = SQL
QryComm.CommandType = adCmdText
Set QryRst = QryComm.Execute
QryRst.MoveFirst
On the execute i receive 'bof or eof encounterd' or therefor it is not finding any records. If i use a sql statement using 'select *' it works fine. What am i doing wrong?
Thanks, liboy1