Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Software > Access Modules daovba ado > Programmaticall...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 4 Topic 1502 of 1609
Post > Topic >>

Programmatically renaming re****ts

by =?Utf-8?B?V29ybGRDVFplbg==?= <WorldCTZen@[EMAIL PROTECTED] Jun 26, 2008 at 11:58 AM

I have a number of re****ts that I want to rename programmatically.
They are all named "[re****tnumber] HP Detail". I want to change that to
"HP 
Detail [re****tnumber]"

The following code filters for re****ts with the proper name structure, 
determines the [re****tnumber] ****tion, then uses the docmd.rename method. 
However, once the sub hits the rename line, it crashes. The error simply
says 
that it can't complete the operation. Error code 29068, which has no Help 
dialogue. 

Can anyone tell me why this is erroring, how should I correct, or is this 
even possible?

Public Sub RenameRe****ts()
Dim obj As AccessObject, Dbs As Object, txtName As String, oldName As
String
q = 0
Set Dbs = Application.CurrentProject
    For Each obj In Dbs.AllRe****ts
        oldName = obj.Name
        If Right(obj.Name, 9) = "HP Detail" Then
            Debug.Print oldName
            q = InStr(obj.Name, " HP")
            txtName = "Detail HP " & Left(oldName, q - 1)
            Debug.Print txtName
            DoCmd.Rename txtName, acRe****t, oldName
            DoEvents
        End If
    Next obj
Set Dbs = Nothing
End Sub
 




 4 Posts in Topic:
Programmatically renaming reports
=?Utf-8?B?V29ybGRDVFplbg=  2008-06-26 11:58:01 
RE: Programmatically renaming reports
=?Utf-8?B?U3RldmUgU2FuZm9  2008-07-01 22:11:01 
Re: Programmatically renaming reports
"Jeff Boyce" &l  2008-07-07 15:40:43 
Re: Programmatically renaming reports
"Jeff Boyce" &l  2008-07-07 15:42:07 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Fri Nov 21 12:55:53 CST 2008.