Re: Invalid operation. (Error 3219)
From: Douglas J. Steele (NOSPAM_djsteele_at_NOSPAM_canada.com)
Date: 10/13/04
- Next message: John: "Alter type"
- Previous message: Unicorn: "Re: Invalid operation. (Error 3219)"
- In reply to: Kenneth Goodwin: "Invalid operation. (Error 3219)"
- Next in thread: Kenneth Goodwin: "Re: Invalid operation. (Error 3219)"
- Reply: Kenneth Goodwin: "Re: Invalid operation. (Error 3219)"
- Messages sorted by: [ date ] [ thread ]
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
- Next message: John: "Alter type"
- Previous message: Unicorn: "Re: Invalid operation. (Error 3219)"
- In reply to: Kenneth Goodwin: "Invalid operation. (Error 3219)"
- Next in thread: Kenneth Goodwin: "Re: Invalid operation. (Error 3219)"
- Reply: Kenneth Goodwin: "Re: Invalid operation. (Error 3219)"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|