Re: Invalid operation. (Error 3219)

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance

From: Douglas J. Steele (NOSPAM_djsteele_at_NOSPAM_canada.com)
Date: 10/13/04


Date: Wed, 13 Oct 2004 18:41:52 -0400

Action queries (Insert, Update, Delete) don't generate recordsets.

Instead, use

     gdb.Execute strSQL

Actually, better would be

     gdb.Execute strSQL, dbFailOnError

and you'll get back a trappable error if the insert fails.

-- 
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)
"Kenneth Goodwin" <kennethg@act2000.net> wrote in message
news:uu0mQOFsEHA.2660@TK2MSFTNGP12.phx.gbl...
Invalid operation. (Error 3219)
I am getting this error when using the insert into statement in VB6.
The data engine is DAO to connect to access2003 database.
I tries the select * statement and that work find.
My question to all is why it's not inserting new record to the database?
Form
Option Explicit
Private Sub cmdtest_Click()
Call DataOpen '************ Call the data base *********************
Dim strSQL, xtest1, xtest2 As String
'Dim rsdb As DAO.Recordset
Dim rsdb As ADODB.Recordset
xtest1 = "this is just a test1"
xtest2 = "test is just a nother test"
'strSQL = "SELECT test1, test2 FROM test"
strSQL = "Insert into test(test1, test2)Values('" & xtest1 & "', '" & xtest2
& "')"
Set rsdb = gdb.OpenRecordset(strSQL)
End Sub
Data MODULE
Option Explicit
Public gdb As Database
'Public gdb As Database
Public gstrDatabase As String
'Public Function DataOpen() As Boolean
Public Function DataOpen() As Integer
   gstrDatabase = (App.Path & "\data.mdb")
   Set gdb = DBEngine.Workspaces(0).OpenDatabase(gstrDatabase)
   DataOpen = True
End Function
-- 
Kenneth Goodwin
>From Wadadli Antigua
Enroll in BSIT
goobil@email.uophx.edu
kennethg@act2000.net
(268)727-9949


Relevant Pages

  • Re: Invalid operation. (Error 3219)
    ... The data engine is DAO to connect to access2003 database. ... Dim rsdb As ADODB.Recordset ... 'Public gdb As Database ...
    (microsoft.public.vb.database.dao)
  • Invalid operation. (Error 3219)
    ... The data engine is DAO to connect to access2003 database. ... Dim rsdb As ADODB.Recordset ... 'Public gdb As Database ...
    (microsoft.public.vb.controls)
  • Invalid operation. (Error 3219)
    ... The data engine is DAO to connect to access2003 database. ... Dim rsdb As ADODB.Recordset ... 'Public gdb As Database ...
    (microsoft.public.vb.database.dao)
  • Re: Database has gigantic size
    ... > with the changed data. ... this then is exactly why the database grows so large. ... only a single column of the target row. ... Why were updates within recordsets so ...
    (microsoft.public.vb.database)
  • Re: Database has gigantic size
    ... DAO is simply the direct interface to JET. ... this then is exactly why the database grows so large. ... Why were updates within recordsets so ...
    (microsoft.public.vb.database)