Results 1 to 8 of 8

Thread: [RESOLVED] Recordset does not support scrolling backwards?

  1. #1

    Thread Starter
    Member
    Join Date
    Jan 2008
    Location
    UK
    Posts
    38

    Resolved [RESOLVED] Recordset does not support scrolling backwards?

    i have been geeking away with my stock control system i am creating and have incountered a problem.

    Basically it pops up the message Recordset does not support scrolling backwards with this code.

    Code:
    Public Sub List_Update()
    zero = 0
        
    Set rs = New ADODB.Recordset
    
    sql = "SELECT * FROM itemsInStock"
        
    rs.Open sql, con, adOpenForwardOnly, adLockReadOnly, adCmdText
    
      With lstOutOfStockItems
        .clear 'clears any data already in the list
        Do While Not rs.EOF ' do the following when not end of table
           rs.Find "itemsInStock = " & zero & ""
          .AddItem rs.Fields("itemName").Value 'adds an item to the list from itemsInStock table
          .ItemData(.NewIndex) = rs.Fields("itemsID").Value 'primary key from database set as list index
          rs.MoveNext 'move to next record
        Loop 'carry on loop until end of table
      End With
    
      rs.Close 'closes the recordset
      Set rs = Nothing 'sets rs to nothing
    'End If
    End Sub
    my stock goes down everytime someone buys something and when it reaches 0 i got a form which displays which items are out of stock...and this form is where ive got the problem. Any ideas? Thanks in advance
    Doing a degree in Computer Network Technology with a Cisco qualification module

    Current programming languages i use : C#, C++ PHP, Visual Basic

    visit my website http://www.mintuz.co.uk for cheap web design solutions

  2. #2
    Frenzied Member Jim Davis's Avatar
    Join Date
    Mar 2001
    Location
    Mars base one Username: Jim Davis Password: yCrm33
    Posts
    1,284

    Re: Recordset does not support scrolling backwards?

    What about the enum 'adOpenForwardOnly'? Can you tell me what does it mean?
    Can you just write into ADODB recordset, by set the adLockReadOnly ?

    Copy pasting vb6 code will not work. Never. Instead of that, read tutorials. Worth the effort, to learn the usage.

    http://www.vb6.us/tutorials/database...o-vb6-tutorial

  3. #3

    Thread Starter
    Member
    Join Date
    Jan 2008
    Location
    UK
    Posts
    38

    Re: Recordset does not support scrolling backwards?

    adOpenForwardOnly ...makes forward movement only possible which is what i want as i want the items to show up in order they were inputted.
    Doing a degree in Computer Network Technology with a Cisco qualification module

    Current programming languages i use : C#, C++ PHP, Visual Basic

    visit my website http://www.mintuz.co.uk for cheap web design solutions

  4. #4
    Software Carpenter dee-u's Avatar
    Join Date
    Feb 2005
    Location
    Pinas
    Posts
    11,127

    Re: Recordset does not support scrolling backwards?

    adOpenForwardOnly says it only, such recordset type only supports scrolling forward, try another type instead.
    Regards,


    As a gesture of gratitude please consider rating helpful posts. c",)

    Some stuffs: Mouse Hotkey | Compress file using SQL Server! | WPF - Rounded Combobox | WPF - Notify Icon and Balloon | NetVerser - a WPF chatting system

  5. #5
    Frenzied Member Jim Davis's Avatar
    Join Date
    Mar 2001
    Location
    Mars base one Username: Jim Davis Password: yCrm33
    Posts
    1,284

    Re: Recordset does not support scrolling backwards?

    Sure, sorry for my harsh manner.

    First, set it to adOpenDynamic lets see how it works now. Also you are about to modify the recordset, dont open it as readonly.

    at where the error occurs?

    edit:
    heh no you doesnt modify, i mispelld :P

    So. where the error occurs?

  6. #6

    Thread Starter
    Member
    Join Date
    Jan 2008
    Location
    UK
    Posts
    38

    Re: Recordset does not support scrolling backwards?

    it occurs on this line
    Code:
           rs.Find "itemsInStock = " & zero & ""
    Doing a degree in Computer Network Technology with a Cisco qualification module

    Current programming languages i use : C#, C++ PHP, Visual Basic

    visit my website http://www.mintuz.co.uk for cheap web design solutions

  7. #7
    PowerPoster
    Join Date
    Oct 2002
    Location
    British Columbia
    Posts
    9,758

    Re: Recordset does not support scrolling backwards?

    Find requires a scrollable cursor.

    You can keep using ForwardOnly if you eliminate the use of the Find method.

    Add a Where clause to the SQL statement instead.

    sql = "SELECT * FROM itemsInStock where itemsInStock = 0"

  8. #8

    Thread Starter
    Member
    Join Date
    Jan 2008
    Location
    UK
    Posts
    38

    Re: Recordset does not support scrolling backwards?

    Ok i got it working thanks i didnt no you have to get rid of .find if using forward only.
    Doing a degree in Computer Network Technology with a Cisco qualification module

    Current programming languages i use : C#, C++ PHP, Visual Basic

    visit my website http://www.mintuz.co.uk for cheap web design solutions

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width