473,385 Members | 1,769 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Can somebody help me in Navigation of recordset using ADO

Hi,

I have written a code to navigate through the recordset using MoveFirst,Movenext,MovePrevious and MoveLast

i would like to fetch the records from the database and display it on a form in the textboxes.When i try to move from one record to another using MoveNext command it moves directly to the last record

Here is the code

Dim cn1 As ADODB.Connection
Dim rs1 As ADODB.Recordset
Set cn1 = New ADODB.Connection
Set rs1 = New ADODB.Recordset
Const DBPATH = "C:\Documents and Settings\hebbark\Desktop\democlaims.mdb"
Dim stfl As String
Dim fl As String
fl = "\democlaims.mdb"
stfl = CurrentProject.Path & fl
Dim constring As String
constring = "Provider=Microsoft.jet.OLEDB.4.0;Data Source=" & stfl
cn1.Open constring

rs1.Open "demo_claim", cn1, adOpenDynamic, adLockOptimistic, adCmdTable

While Not rs1.EOF
DTPicker5.Value = rs1.Fields(0)
DTPicker6.Value = rs1.Fields(1)
Text7 = rs1.Fields(2)
Text9 = rs1.Fields(3)
Text13 = rs1.Fields(4)
Text15 = rs1.Fields(5)
Text17 = rs1.Fields(6)
Text11 = rs1.Fields(7)

rs1.MoveNext
Wend
Oct 18 '06 #1
1 2486
willakawill
1,646 1GB

While Not rs1.EOF
DTPicker5.Value = rs1.Fields(0)
DTPicker6.Value = rs1.Fields(1)
Text7 = rs1.Fields(2)
Text9 = rs1.Fields(3)
Text13 = rs1.Fields(4)
Text15 = rs1.Fields(5)
Text17 = rs1.Fields(6)
Text11 = rs1.Fields(7)

rs1.MoveNext
Wend
This is a loop running to the end of the recordset. You will always end up at the last record with this loop and your form will always show the fields from the last record
Oct 18 '06 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Robert Neville | last post by:
I am having some trouble with some old code revolving around custom form navigation buttons. My main form has a sub-form with these custom navigation buttons. In other words, the code should be...
2
by: Ellen Manning | last post by:
I'm developing an A2K adp that contains doctor info and the months they are not available for teaching. A doctor can be unavailable for some months for one year and other months for another year. ...
2
by: longtim | last post by:
I have been trying to implement navigation buttons for a number of forms in my application. Creating the 'Next' 'Previous' buttons has been fine but setting the enabled properties doesn't work...
1
by: Galka | last post by:
Hello I have a form to enter names and some other personal information. When a name is entered, it is checked against existing records: maybe, such name was entered before? If yes, user is...
4
by: Jamey Shuemaker | last post by:
Howdy, Saw a couple threads from the past few years on this topic, but didn't really find any solutions. Here's one I found:...
14
by: Rational Repairs | last post by:
I am trying to create global code for navigation use in all my forms -- including subforms. I searched, and searched, but can not find how to globally reference a subform object. I need to have the...
36
by: beebelbrox | last post by:
Hi, I am new VB programming in Access and I am requesting help with the following code. WIndows OS MSaccess 2003 This code is attached to an unbound form that will display a specific recordset...
8
by: vaniKanabathy | last post by:
Hi, i want to do navigation button like first, previous, next and last using command button. When user click the first button, the first record in access must appear . I do using the coding below but...
0
by: emalcolm_FLA | last post by:
Hello and TIA for your consideration. I have created several db's for a non-profit and they want custom navigation buttons to display "You are on the first record, last record, etc". With this...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.