I am executing an SQL statement off the Connection object which is connected
to an Access97 MDB file. I basically tell it to create a table. The table
gets created, but I also get this error:
Description: Either BOF or EOF is True, or the current record has been deleted.
Requested operation requires a current record.
Number: 3021
Source: ADODB.Field
I can't figure it out, below is the command I am sending.
"Robert Gelb" <Robert.Gelb-nospam@db.com> wrote:
>
>I am executing an SQL statement off the Connection object which is connected
>to an Access97 MDB file. I basically tell it to create a table. The table
>gets created, but I also get this error:
>
>Description: Either BOF or EOF is True, or the current record has been deleted.
>Requested operation requires a current record.
>Number: 3021
>Source: ADODB.Field
>
>I can't figure it out, below is the command I am sending.
>
>Create Table tempTable
>([RecordTypeZZ] TEXT(1) NULL,
>[Issue_Code] TEXT(5) NULL,
>[Organiz_Code] TEXT(3) NULL,
>[Unknown1] TEXT(4) NULL,
>[tape_date] TEXT(6) NULL,
>[Filler] TEXT(231) NULL,
>[RecordTypeD] TEXT(1) NULL,
>[Loan_Number] integer NULL,
>[ptd] TEXT(6) NULL,
>[loan_status_1] TEXT(1) NULL,
>[delinq_amt] TEXT(12) NULL,
>[pif_status] TEXT(1) NULL,
>[loan_status] TEXT(1) NULL)
>
>What is wrong with this statement.
>
>Regards,
>
>Robert Gelb
You need the ADOX object library for this, not ADODB. J-Y.
01-12-2001, 11:14 AM
Igor
Re: Driving me nuts
"jy" <jy@directdialog.com> wrote:
>
>"Robert Gelb" <Robert.Gelb-nospam@db.com> wrote:
>>
>>I am executing an SQL statement off the Connection object which is connected
>>to an Access97 MDB file. I basically tell it to create a table. The table
>>gets created, but I also get this error:
>>
>>Description: Either BOF or EOF is True, or the current record has been
deleted.
>>Requested operation requires a current record.
>>Number: 3021
>>Source: ADODB.Field
>>
>>I can't figure it out, below is the command I am sending.
>>
>>Create Table tempTable
>>([RecordTypeZZ] TEXT(1) NULL,
>>[Issue_Code] TEXT(5) NULL,
>>[Organiz_Code] TEXT(3) NULL,
>>[Unknown1] TEXT(4) NULL,
>>[tape_date] TEXT(6) NULL,
>>[Filler] TEXT(231) NULL,
>>[RecordTypeD] TEXT(1) NULL,
>>[Loan_Number] integer NULL,
>>[ptd] TEXT(6) NULL,
>>[loan_status_1] TEXT(1) NULL,
>>[delinq_amt] TEXT(12) NULL,
>>[pif_status] TEXT(1) NULL,
>>[loan_status] TEXT(1) NULL)
>>
>>What is wrong with this statement.
>>
>>Regards,
>>
>>Robert Gelb
>You need the ADOX object library for this, not ADODB. J-Y.
This is not necessarily true. Yes you can use ADOX object library to create
Database, but you can also use ADODB connection to execute any of DML SQL
statements that MS Access supports as well. I just ran this code against
Northwind Database and did not have any problems/errors.
Private Sub CreateTable(strTableName As String)
Dim oConn As New ADODB.Connection
Dim strSQL As String
oConn.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=d:\nwind.mdb;"
Private Sub DropTable(strTableName As String)
Dim oConn As New ADODB.Connection
Dim strSQL As String
oConn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=d:\nwind.mdb;"
strSQL = "Drop table " & strTableName
oConn.Execute strSQL
Set oConn = Nothing
End Sub
I do not now what's wrong with Robert's code really, but I would check the
Provider of connection object first.
Good luck.
Igor
01-12-2001, 02:17 PM
Robert Gelb
Re: Driving me nuts
Thanks for response. I've gotten to the bottom of it. There was On Error
Resume Next several lines before the statement in seemingly innocuous code
and that is where the error was happening. Unfortunately the error handler
was after the .Execute statement.
"Igor" <irodionov@hotmail.com> wrote:
>
>"jy" <jy@directdialog.com> wrote:
>>
>>"Robert Gelb" <Robert.Gelb-nospam@db.com> wrote:
>>>
>>>I am executing an SQL statement off the Connection object which is connected
>>>to an Access97 MDB file. I basically tell it to create a table. The
table
>>>gets created, but I also get this error:
>>>
>>>Description: Either BOF or EOF is True, or the current record has been
>deleted.
>>>Requested operation requires a current record.
>>>Number: 3021
>>>Source: ADODB.Field
>>>
>>>I can't figure it out, below is the command I am sending.
>>>
>>>Create Table tempTable
>>>([RecordTypeZZ] TEXT(1) NULL,
>>>[Issue_Code] TEXT(5) NULL,
>>>[Organiz_Code] TEXT(3) NULL,
>>>[Unknown1] TEXT(4) NULL,
>>>[tape_date] TEXT(6) NULL,
>>>[Filler] TEXT(231) NULL,
>>>[RecordTypeD] TEXT(1) NULL,
>>>[Loan_Number] integer NULL,
>>>[ptd] TEXT(6) NULL,
>>>[loan_status_1] TEXT(1) NULL,
>>>[delinq_amt] TEXT(12) NULL,
>>>[pif_status] TEXT(1) NULL,
>>>[loan_status] TEXT(1) NULL)
>>>
>>>What is wrong with this statement.
>>>
>>>Regards,
>>>
>>>Robert Gelb
>>You need the ADOX object library for this, not ADODB. J-Y.
>
> This is not necessarily true. Yes you can use ADOX object library to
create
>Database, but you can also use ADODB connection to execute any of DML SQL
>statements that MS Access supports as well. I just ran this code against
>Northwind Database and did not have any problems/errors.
>
>
>Private Sub CreateTable(strTableName As String)
>Dim oConn As New ADODB.Connection
>Dim strSQL As String
>oConn.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
>"Data Source=d:\nwind.mdb;"
>
>strSQL = "Create Table " & strTableName & _
>"([RecordTypeZZ] TEXT(1) NULL," & _
>"[Issue_Code] TEXT(5) NULL," & _
>"[Organiz_Code] TEXT(3) NULL," & _
>"[Unknown1] TEXT(4) NULL," & _
>"[tape_date] TEXT(6) NULL," & _
>"[Filler] TEXT(231) NULL," & _
>"[RecordTypeD] TEXT(1) NULL," & _
>"[Loan_Number] integer NULL," & _
>"[ptd] TEXT(6) NULL," & _
>"[loan_status_1] TEXT(1) NULL," & _
>"[delinq_amt] TEXT(12) NULL," & _
>"[pif_status] TEXT(1) NULL," & _
>"[loan_status] TEXT(1) NULL)"
>
>oConn.Execute strSQL
>Set oConn = Nothing
>End Sub
>
>Private Sub DropTable(strTableName As String)
>Dim oConn As New ADODB.Connection
>Dim strSQL As String
>
>oConn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=d:\nwind.mdb;"
>strSQL = "Drop table " & strTableName
>oConn.Execute strSQL
>Set oConn = Nothing
>End Sub
>
>I do not now what's wrong with Robert's code really, but I would check the
>Provider of connection object first.
>Good luck.
>Igor
>
>
>
>
>
>
>
>