Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access VBA
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Access VBA Discuss using VBA for Access programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access VBA section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old August 30th, 2003, 10:06 AM
Registered User
 
Join Date: Aug 2003
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Record Pointer moves, do not get current fields

Whats wrong with this:

Thanx for any suggestions.

Option Compare Database
Option Explicit
Dim CurDb As DAO.Database
Dim MEMPass As DAO.Recordset
Dim memTEST As String

Private Sub Command0_Click()
Set CurDb = CurrentDb()
Set MEMPass = CurDb.OpenRecordset("sysPasswordsT")
DoCmd.OpenTable "sysPasswordsT"
DoCmd.GoToRecord acDataTable, "sysPassWordsT", acFirst
DoCmd.GoToRecord acDataTable, "sysPassWordsT", acNext
DoCmd.GoToRecord , "sysPassWordsT", acNext
memTEST = MEMPass!Password
MsgBox (memTEST) 'this box returns first record, not 3 record !?
End Sub

MsgBox should return data from password in third record, yes?

help! Thanx.

Reply With Quote
  #2 (permalink)  
Old August 30th, 2003, 11:32 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: , , USA.
Posts: 1,093
Thanks: 1
Thanked 12 Times in 11 Posts
Default

Hi James,

Your code is navigating through the physical base table, not the recordset object you created. Use the recordset objects Move methods to navigate the recordset:

Dim CurDb As DAO.Database
Dim MEMPass As DAO.Recordset
Dim memTEST As String

Private Sub Command0_Click()
    Set CurDb = CurrentDb()
    Set MEMPass = CurDb.OpenRecordset("sysPasswordsT")
    MEMPass.MoveFirst
    MEMPass.MoveNext
    MEMPass.MoveNext
    memTEST = MEMPass!Password
    MsgBox (memTEST) ' displays third record
End Sub

HTH,

Bob


Reply With Quote
  #3 (permalink)  
Old August 30th, 2003, 12:15 PM
Registered User
 
Join Date: Aug 2003
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

:)thanx Bob.

Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
mouse wheel moves to new record on subform lhedquist Access 7 January 19th, 2006 11:42 AM
Current Record Number Base VB How-To 1 December 7th, 2005 05:26 PM
UPDATE CURRENT RECORD ranakdinesh Classic ASP Databases 6 March 18th, 2005 02:22 AM
Error 3021 - No Current Record JackNimble BOOK: Expert One-on-One Access Application Development 5 October 2nd, 2004 03:26 PM
Print current record vladimir Access 2 September 10th, 2003 11:53 PM



All times are GMT -4. The time now is 07:17 PM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.