Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > Beginning VB 6
Password Reminder
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Beginning VB 6 For coders who are new to Visual Basic, working in VB version 6 (not .NET).
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Beginning VB 6 section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old September 3rd, 2006, 06:55 PM
Registered User
Join Date: Jul 2006
Location: , , .
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default recordset open error

hi,i have a listbox which i'm facing problems with in storing its contents to its respective field in the database.code is as below, however an error occurred where it reads 'rs2.Open' statin that 'method or data member not found'...any help on this part? by the way, this is where i'm adding new records to my database.

Private sub cmdAdd_click()
Dim rs2 As Recordset
Dim strMyStr As String
Dim conn As New ADODB.Connection
Dim sSQL As String, sConn As String
sConn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\legalminder1.mdb;Persist Security Info=False"

'        Set wk2 = DBEngine.CreateWorkspace("MyWks", "admin", "", dbUseJet)
'        Set db2 = wk2.OpenDatabase("c:\Project 1\legalminder1.mdb", False)
'       Set rs2 = db2.OpenRecordset("addrecord", dbOpenDynaset)
        On Error GoTo errHnd
        sSQL = "SELECT * FROM addrecord"
        Set conn = New ADODB.Connection
        'con.ConnectionString = sConn
        conn.Open sConn
        Set rs2 = New ADODB.Recordset
        rs2.Open sSQL, conn, adOpenStatic, adLockOptimistic

'        MsgBox "Add Record", vbInformation, "Record"
'        now we can add the record

        rs2.Fields(1).Value = UCase(txtDefineTask.Text)
        rs2.Fields(2).Value = UCase(txtDocuments.Text)
        rs2.Fields(3).Value = DTPicker1.Value
        rs2.Fields(4).Value = CInt(txtDays.Text)
        rs2.Fields(5).Value = UCase(txtNotes.Text)
'        here we first need to create a string
        rs2.Fields(6).Value = GetListItems()

'        lstAttach.AddItem NoNull(rs2.Fields(6).Value)

        txtDefineTask = ""
        txtDocuments = ""
        DTPicker1.Value = Date
        txtDays = ""
        txtNotes.Text = ""
        ' when we reach this point without any error we can do this msg
        MsgBox "Record added Successfully", vbInformation, "Record"
    End If

' The connection needs to be closed in any case- so we add this lines
    If rs2.State = adStateOpen Then
        Set rs2 = Nothing
    End If
    If conn.State = adStateOpen Then
        Set conn = Nothing
    End If
    Exit Sub
errHnd:             ' this is the entry point for errorhandler
    Call MsgBox(Err.Description, vbCritical + vbOKOnly, "Storing Data failed")
GoTo LeavePoint ' also closing connection in errorcase

 End Sub

Reply With Quote
  #2 (permalink)  
Old September 3rd, 2006, 11:11 PM
Friend of Wrox
Join Date: Jan 2006
Location: Hardwar, Uttranchal, India.
Posts: 180
Thanks: 1
Thanked 1 Time in 1 Post
Send a message via ICQ to dpkbahuguna Send a message via MSN to dpkbahuguna Send a message via Yahoo to dpkbahuguna

Frnd I think you forgot to use the ADODB Class in initialization


   Dim rs2 As ADODB.Recordset = Dim rs2 As Recordset

Reply With Quote
  #3 (permalink)  
Old September 4th, 2006, 04:52 PM
Registered User
Join Date: Jul 2006
Location: , , .
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts

hey thanks, got that!

Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
ADODB.Recordset error lance Wrox Book Feedback 2 February 23rd, 2007 02:37 PM
Get the error "ADODB.Recordset error '800a0e7d' " Raymond Classic ASP Databases 2 August 5th, 2006 03:53 PM
Recordset Error malhyp Dreamweaver (all versions) 3 December 21st, 2005 05:06 PM
Please on help recordset can't open mars1009 Classic ASP Databases 2 November 15th, 2004 02:43 AM
Recordset error lance Access ASP 1 February 17th, 2004 07:12 AM

All times are GMT -4. The time now is 08:51 AM.

Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.