|
-
Nov 27th, 2008, 11:37 AM
#1
Thread Starter
Member
[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
-
Nov 27th, 2008, 12:00 PM
#2
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
-
Nov 27th, 2008, 12:08 PM
#3
Thread Starter
Member
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
-
Nov 27th, 2008, 12:10 PM
#4
Re: Recordset does not support scrolling backwards?
adOpenForwardOnly says it only, such recordset type only supports scrolling forward, try another type instead.
-
Nov 27th, 2008, 12:13 PM
#5
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?
-
Nov 27th, 2008, 12:18 PM
#6
Thread Starter
Member
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
-
Nov 27th, 2008, 12:19 PM
#7
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"
-
Nov 27th, 2008, 12:28 PM
#8
Thread Starter
Member
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|