Results 1 to 11 of 11
  1. #1
    gparl is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2013
    Posts
    4

    Problem with Docmd.Remane Docmd @ acTable not declared

    I have searched for a long time to solve this issue all I can get is the is the code which give me the error. I should be able to find the answer by microsoft but there sites are less than helpful

    Here is my complete code what is wrong or what am I missing ( what referrance or what import is required) all I want to do is change an accdb table name with vb.net and a textbox or inputbox.


    Private Sub btnCHGName_Click(sender As System.Object, e As System.EventArgs) Handles btnCHGName.Click
    On Error GoTo Err_ErrorHandler
    Dim Con As OleDbConnection
    Dim strTable As String

    strTable = InputBox("Please enter the new table name.", "Table Name")

    If strTable = vbNullString Then
    MsgBox("No table name entered.", vbExclamation)


    Else
    DoCmd.Rename("NameNewTable", acTable, "strTable") ' (also tried to use acDefault in place of acTable with same error)
    MsgBox("Table successfully renamed.", vbInformation)
    End If

    Exit_ErrorHandler:
    strTable = vbNullString
    Exit Sub

    Err_ErrorHandler:
    MsgBox(Err.Description, vbExclamation, "Error #" & Err.Number)
    Resume Exit_ErrorHandler

    End Sub



    I don't care what the code is I just want to change the friken name Why the hell does microsoft make every thing so complicated. This should be an easy procdure.
    Last edited by gparl; 03-12-2013 at 11:46 AM.

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,913
    If you are doing from VB.net, then sounds like a VB.net issue, not Access.

    Why do you want to change table name with code?

    You might try SQL Alter Table action http://www.techonthenet.com/sql/tables/alter_table.php
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    gparl is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2013
    Posts
    4

    you could be right

    Quote Originally Posted by June7 View Post
    If you are doing from VB.net, then sounds like a VB.net issue, not Access.

    Why do you want to change table name with code?

    You might try SQL Alter Table action http://www.techonthenet.com/sql/tables/alter_table.php
    I have also tried to use alter from the above mentioned site but have had issues also more explaination on this site would be helpful.

    As to why I am creating an app for my own use and just wish to create a new table and name the table without going to access

    I will try other method.

  4. #4
    dr91075 is offline Novice
    Windows Vista Access 2007
    Join Date
    Mar 2013
    Posts
    22
    What error are you receiving? Have you stepped through and identified the line at which it fails?

  5. #5
    gparl is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2013
    Posts
    4

    errors

    Quote Originally Posted by dr91075 View Post
    What error are you receiving? Have you stepped through and identified the line at which it fails?

    Yes errors are Docmd is not declared & acTable is not declared

  6. #6
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,913
    This might be relevant http://social.msdn.microsoft.com/For...9-7563bc6ffa67

    Indicates issue with 64-bit (4th post)

    Still looks like a VB.net, not Access, issue.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  7. #7
    dr91075 is offline Novice
    Windows Vista Access 2007
    Join Date
    Mar 2013
    Posts
    22
    Try changing acDefault to acTable.

  8. #8
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,913
    dr91075, OP stated tried both parameters without success.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  9. #9
    dr91075 is offline Novice
    Windows Vista Access 2007
    Join Date
    Mar 2013
    Posts
    22
    Oops! My apologies to the OP. You are correct.

  10. #10
    dr91075 is offline Novice
    Windows Vista Access 2007
    Join Date
    Mar 2013
    Posts
    22
    This method worked for me on my 64bit:

    Code:
    Sub RenameTable()
    CurrentDb.TableDefs("oldtablename").name = "newtablename"
    End Sub

  11. #11
    gparl is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2013
    Posts
    4

    Give up

    Quote Originally Posted by dr91075 View Post
    Oops! My apologies to the OP. You are correct.

    I do believe that it is a 64 bit issue and although I have debug and compile set for x86 I think that the only solution will be to change this in access itself thank you all for the info it is appreciated.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. DoCmd.OutputTo
    By tylerg11 in forum Reports
    Replies: 2
    Last Post: 08-09-2012, 12:22 PM
  2. Need help w/ docmd.openreport
    By jwill in forum Reports
    Replies: 3
    Last Post: 06-04-2012, 09:49 PM
  3. problem with my DoCmd.RunSQL statement
    By cgclower in forum Access
    Replies: 1
    Last Post: 07-24-2011, 06:12 PM
  4. Problem with DoCMD.DeleteObject or IsObject
    By P5C768 in forum Programming
    Replies: 6
    Last Post: 11-30-2010, 12:14 PM
  5. Problem with DoCmd.RunSQL
    By Peter01 in forum Programming
    Replies: 2
    Last Post: 09-10-2009, 07:11 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums