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 | 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 November 2nd, 2004, 03:59 PM
Authorized User
 
Join Date: Apr 2004
Location: Montreal, Quebec, Canada.
Posts: 45
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to lguzman
Default Creating a log file from actions taken in a form

I have created a form where users select a start range, end range and a adjusting value. They would then click on a "GO" button, an a update query will modify the value of the selected range by the adjusting value. I would like to keep track of the changes made by the users by appending the starting range, end range, adjustment value and date in a log file.

I have come up with the following code but I keep getting a "No current record." error.

    Dim wrkDefault As Workspace
    Dim dbs As Database
    Dim rst As Recordset
    Set wrkDefault = DBEngine.Workspaces(0)
    Set dbs = CurrentDb
    Set rst = dbs.OpenRecordset("PrinterNumberConversionLog")
    wrkDefault.BeginTrans
    With rst
         .AddNew
         !LogAdjustedDate = Date
         !LogStartingRange = [Forms]![AAA-4to7DigitForm]![StartRange]
         !LogEndingRange = [Forms]![AAA-4to7DigitForm]![EndRange]
         !LogAdjustmentBy = [Forms]![AAA-4to7DigitForm]![AdjustBy]
         .Update
         .MoveNext
    End With
    wrkDefault.CommitTrans
    dbs.Close

Thanks.



[LGuzman]
__________________
[LGuzman]
Reply With Quote
  #2 (permalink)  
Old November 2nd, 2004, 04:19 PM
Authorized User
 
Join Date: Oct 2004
Location: Austin, TX, USA.
Posts: 59
Thanks: 0
Thanked 0 Times in 0 Posts
Default

What is the purpose of the .MoveNext? Because you just added a record, you're on the "last" one in the recordset, so a MoveNext will get you No Current Record.

And by the way, if this code is running in the form named [AAA-4to7DigitForm], you can reference the controls using Me:

  !LogStartingRange = Me.StartRange


John Viescas, author
"Microsoft Office Access 2003 Inside Out"
"Running Microsoft Access 2000"
"SQL Queries for Mere Mortals"
Reply With Quote
  #3 (permalink)  
Old November 3rd, 2004, 10:58 AM
Authorized User
 
Join Date: Apr 2004
Location: Montreal, Quebec, Canada.
Posts: 45
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to lguzman
Default

Thanks for your help.



[LGuzman]
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
Can't get Log to write the Log.txt file jnbutler BOOK: Professional XNA Game Programming: For Xbox 360 and Windows ISBN: 978-0-470-12677-6 3 July 31st, 2007 04:04 AM
Creating an excel file and showing on the form dotnetprogrammer C# 0 May 3rd, 2005 07:36 AM
Log file tsimsha Classic ASP Databases 1 April 30th, 2005 04:27 AM
problem for creating the separate log file for con goel_man Apache Tomcat 0 December 19th, 2004 11:48 AM
Creating a log file for multiple users patwadd Classic ASP Basics 19 June 24th, 2004 08:14 AM



All times are GMT -4. The time now is 10:11 AM.


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