Results 1 to 2 of 2
  1. #1
    hyperionfall is offline Novice
    Windows XP Access 2007
    Join Date
    Mar 2010
    Location
    mississippi
    Posts
    18

    docmd.rename wierd results

    i am trying to rename a table in access 2007 using form fields as variable in
    DoCmd.Rename "Old Employees Table", acTable, "Employees"
    I have the following code:

    Private Sub Command7_Click()

    Dim TableNew As String
    Dim TableOld As String
    Dim UpDate As String
    Dim What As String

    TableNew = Chr(34) & Me.Text5 & Chr(34) & ","
    TableOld = Chr(34) & Me.text1 & Chr(34)
    What = "acTable" & ","

    UpDate = TableNew & " " & What & " " & TableOld

    DoCmd.Rename UpDate
    End Sub




    my results are kinda wacky:
    it renamed my table as follows:

    "uhd002", actable, "uhd005"

    where uhd002 is the value in form field me.text5 and udh005 is the value of form field me.text1 .

    this is im sure a syntax snafu that i am braindead on.

    any help would be apreciated

  2. #2
    hyperionfall is offline Novice
    Windows XP Access 2007
    Join Date
    Mar 2010
    Location
    mississippi
    Posts
    18
    ok i got it...went way to far with it at first. this is the code i found to work.

    Private Sub Command7_Click()

    Dim TableNew As String
    Dim TableOld As String

    TableNew = Me.Text5
    TableOld = Me.text1

    DoCmd.Rename TableNew, acTable, TableOld

    End Sub

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

Similar Threads

  1. Wierd subdatasheet problem
    By Lynnwood in forum Access
    Replies: 0
    Last Post: 10-30-2009, 08:12 PM
  2. Transfer SpreadSheet Command and Rename
    By fintan06 in forum Import/Export Data
    Replies: 2
    Last Post: 10-15-2009, 08:00 AM
  3. Issues with DoCmd.GoToControl
    By RaMcHiP in forum Programming
    Replies: 1
    Last Post: 05-09-2009, 08:56 PM
  4. DoCmd.OpenForm Modification
    By alsoto in forum Forms
    Replies: 6
    Last Post: 05-01-2009, 07:28 AM
  5. DoCmd.SendObject Help
    By bgreer5050 in forum Programming
    Replies: 0
    Last Post: 01-12-2007, 06:27 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