Wrox Programmer Forums
|
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 software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 17th, 2011, 03:40 PM
Authorized User
 
Join Date: Nov 2011
Posts: 24
Thanks: 1
Thanked 0 Times in 0 Posts
Default Run Time Error - 3052

I have a module that is creating a Run Time Error.

Code:
Public Sub TrimZeroesPayments()

Dim rec As DAO.Recordset
Dim lngLoop As Long
Dim lngCount As Long
Dim strData As String
Dim strTemp As String

Set rec = CurrentDb.OpenRecordset("TblAllPayments-History")
rec.MoveLast
rec.MoveFirst
lngCount = rec.RecordCount
For lngLoop = 1 To lngCount
strData = rec("Invoice Number")
strTemp = Left(strData, 1)
Do While strTemp = "0"
strData = Mid(strData, 2)
strTemp = Left(strData, 1)
Loop
rec.Edit
rec("Invoice Number") = strData
rec.Update
rec.MoveNext
Next lngLoop
Set rec = Nothing

End Sub
This database has been working for a few months, this is the first of this error to my knowledge. It breaks at the "Rec.Edit" portion of the code.

Any suggestions?

Last edited by SunnySide; November 17th, 2011 at 03:48 PM..





Similar Threads
Thread Thread Starter Forum Replies Last Post
Insert Query Error & Run-Time Error 3022 DavidWE Access 1 July 31st, 2008 11:17 AM
run-time error(s) Chacko C++ Programming 0 March 4th, 2007 02:28 PM
run time error ashishroyk Java GUI 0 October 8th, 2004 01:42 AM
Run Time Error JBond Access VBA 0 May 27th, 2004 09:50 AM
RUN-TIME ERROR compcad Beginning VB 6 2 May 21st, 2004 02:01 AM





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