Click to See Complete Forum and Search --> : about data access in tables
sreedhar
Jul 27th, 1999, 04:56 PM
im working under ado and i've connected to oracle using ado and bounded the fields to three text boxes and all i want to do is i've placed three command buttons and named it as movefirst,movenext,and previous and just tell me the coding..of that buttons..
im giving like this but it's not working
p.sub command1_click()
rs.movenext
rs!ename=text1.text
rs!empno=text2.text
rs!sal=text3.text
end sub
please solve this problem..friends
bye
my email chavasreedhar@hotmail.com
thorne
Jul 27th, 1999, 06:49 PM
Are you using and ADO control? If so,it has the buttons you mentioned already on the control.
If not, then are you getting an error message stating that rs is an unrecoginized object?
I have been working with ado. To do what you are doing I had to create a subroutine, let's call it DoIt.
private sub DoIt(Switch as string)
select case Switch
case "OPEN"
open the connection and rs
case "NEXT"
rs.movenext
case "PREV"
rs.moveprevious
case "LAST"
rs.movelast
case "FIRST"
rs.movefirst
case "CLOSE"
close the connection
close the recordset
end sub
Then in Command1_Click()
private sub Command1_Click()
DoIt "NEXT"
etc...
I had to do this because I couldn't get a recordset to be opened as a global or even module level object. I could only open it in a subroutine.
But if you are using and ADO control it is done for you automatically.
preeti
Jul 27th, 1999, 10:46 PM
Hi,
Reverse your equal statements:
text1.text=rs!ename
text2.text=rs!empno
text3.text=rs!sal
Preeti
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.