Access: how to rename a table using a macro?
Solved
angy21
Posted messages
39
Status
Member
-
tilalilalu -
tilalilalu -
Hello,
I have a problem with Access. After a lot of searching, I have only resolved it halfway.
Indeed, through a macro, I import an Excel file that I convert into an Access table.
Then, still through a macro, I duplicate this table.
And then comes the rest of my problem because I need to rename (still via macro) this second table but with a random name (name entered manually).
Is there a solution to my problem? Thank you in advance for your help.
--
Angy who wants to add more arrows to her quiver
Every problem has 1 solution, but the hardest part is finding it!
I have a problem with Access. After a lot of searching, I have only resolved it halfway.
Indeed, through a macro, I import an Excel file that I convert into an Access table.
Then, still through a macro, I duplicate this table.
And then comes the rest of my problem because I need to rename (still via macro) this second table but with a random name (name entered manually).
Is there a solution to my problem? Thank you in advance for your help.
--
Angy who wants to add more arrows to her quiver
Every problem has 1 solution, but the hardest part is finding it!
Configuration: Access 2000
3 answers
-
```html you need a function or a procedure vba
Sub nom(ex As String)
Dim u As DAO.Database
Set u = CurrentDb
u.TableDefs(ex).Name = InputBox("enter the new name for " & ex)
End Sub
you can replace function with sub
and ask your macro to execute this code
don't forget to add dao to the vba references
--
isn't life beautiful? ```-
-
Hello Random,
I’m reaching out to you again because, as I feared, I haven’t been able to follow your VBA advice.
Can I ask for your help and request more details on how I should proceed? I'm more than a beginner in VBA.
Thank you in advance, and see you soon.
--
Angy who wants to add more arrows to her quiver
Every problem has a solution, but the hardest part is finding it! -
Hello Random,
I still haven't found the solution to my problem, but you've inspired me to start with VBA. Since Friday, I've been getting into programming thanks to a book.
I think this can only help me with future problems to solve. Thanks again
--
Angy who wants to add more arrows to her quiver
Every problem has one solution, but the hardest part is finding it! -
-
-
-
Hello,
Can anyone help me, please? I'm stuck...
Thanks again
--
Angy who wants to add more arrows to her quiver
Every problem has one solution, but the hardest part is finding it! -
Hi,
If you really want to work with macros this time, I believe you will have to use VBA because I don’t think there’s a way to modify table definitions. But what you can do is create a function in VBA that will create your second table and automatically rename it. After that, you can call this function via a macro if you absolutely must use a macro. For that, you will need to manipulate the TableDef object; check the help documentation or look it up online.
Hope this helps!-
Thank you first of all for your response, and no, I don't have to use macros, but to be honest, I'm struggling with VBA... so it's easier for me to stick with Access macros.
See you soon
--
Angy who wants to add more arrows to her quiver
Every problem has one solution, but the hardest part is finding it!
-