Question about Microsoft Computers & Internet
Here is my code
nothing is happen when i am clicking
or some times only one record is moved for move next
Private Sub cmdnext_Click()
Dim st As String
Dim que As String
Dim con As ADODB.Connection
Dim REC As ADODB.Recordset
st = "provider=microsoft.jet.oledb.4.0;Data source=" + App.Path + "db1.mdb"
Set con = New ADODB.Connection
.ConnectionString = st
que = "select * from class_add where class='" + cmbedit.Text + "'"
Set REC = New ADODB.Recordset
REC.Open que, con, adOpenDynamic, adLockReadOnly
If Not REC.BOF Then REC.MoveNext
txtclass.Text = REC("class")
txtteacher.Text = REC("claasteacher")
txtleader.Text = REC("leader")
totstd.Text = REC("totstd")
txtsubj.Text = REC("no_subj")
txtroom.Text = REC("room_no")
thank you for spending your time
I see 2 problems with your code.
1) Each time you call cmdnext_Click, you're reopening the database. Each time you do that, you start at the beginning of the file. You need to have the database opened once, somewhere else in your program. Be sure that the record set is visible from this sub.
2) In order to use the "Next" function, you need a loop like this
'test for no records
IF REC.BOF and REC.EOF then
msgbox "No Records Found"
IF NOT REC.EOF then
(display your fields)
Again, this will only work if your database is opened outside of the cmdNext_Click routine.
Posted on Jul 16, 2008
a 6ya expert can help you resolve that issue over the phone in a minute or two.
best thing about this new service is that you are never placed on hold and get to talk to real repairmen in the US.
the service is completely free and covers almost anything you can think of (from cars to computers, handyman, and even drones).
click here to download the app (for users in the US for now) and get all the help you need.
Posted on Jan 02, 2017
Tips for a great answer:
May 03, 2011 | HP Pavilion dv4000 Notebook
Apr 27, 2009 | Computers & Internet
Mar 26, 2009 | Microsoft Visual Basic 6.0 for PC
Mar 25, 2009 | Computers & Internet
Feb 26, 2009 | Computers & Internet
Jan 07, 2009 | Microsoft Visual Basic 6.0 for PC
Dec 10, 2008 | Computers & Internet
Jul 16, 2008 | Microsoft Office Access 2003 (077-02871)...
Sep 19, 2007 | Adobe Photoshop CS2 for PC
1,182 people viewed this question
Usually answered in minutes!