Solved

Manipulating Records

Posted on 2000-03-20
2
156 Views
Last Modified: 2010-05-02
How do i move from one record to the other. I tried using movelast, moveprevious,movenext and movefirst, in visual basic 6.0. The records are in the table in a database(ACCESS 2000). I have used the following code and nothing is happening
 " Private sub mnuMoveFirst_()
    rsaddstaff.movefirst
    StaffRecord.visible = true
  End Sub"

where: rsaddstaff is a recordset
       Staffrescord is a form name

 
0
Comment
Question by:bellamoahi
2 Comments
 
LVL 12

Expert Comment

by:mark2150
ID: 2636531
Moving to the new record doesn't automatically update the screen if you're not using bound controls. You should have some code to copy the record's fields to the controls for display:

Text1.Text = trim("" & rs!MyFieldName)

repeat for all fields in the set.

Conversely you can use bound controls, but I find the above method more controllable.

M
0
 
LVL 1

Accepted Solution

by:
simonstre earned 50 total points
ID: 2637493
I would declare ur recordset as this:


Dim rsAddStaff as new adobd.recordset
rsAddStaff.open "select * from [Table Name]",YourConnectionString,adopendynamic, adlockoptimistic

rsAddStaff.refresh 'To be sure that the record is up to date.  It will be positionned at the first record.
0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question