Modules & VBA :: How To Rename Table
Jul 16, 2013
I'm having about 100 table with the following name: phres01, phres02, phres03 .....phres100
And I need to rename them to ph01, ph02, ph03 ... ph100 respectively
thus removing the "res" part of each table. Since the ctrl+h doesn't work for access LOL im in hella trouble.
View Replies
ADVERTISEMENT
Feb 25, 2015
I am importing different excel sheets into Access dB using a file dialog. The importing works fine however, I would like to rename the tables once they are imported to the name of the first column heading. Where exactly would I ad the name change at in this code?
#' Open the EXCEL file and read the worksheet names into a collection
Set colWorksheets = New Collection
Set objWorkbook = objExcel.Workbooks.Open(StrFileName, , blnReadOnly, , _
strPassword)
For lngCount = 1 To objWorkbook.Worksheets.Count
colWorksheets.Add objWorkbook.Worksheets(lngCount).Name
[Code] .....
View 2 Replies
View Related
Jul 2, 2014
I am using access 2010. I need to rename a table when I import the a new table. But I can't get the docmd rename code to work. I also want to append the current date on the end i.e.
docmd.rename, "tblOldTable(Currentdate)", actable, "tblOldTable"
doesn't work.
View 10 Replies
View Related
Dec 17, 2013
I want to rename a report by clicking a command button on a form. I have this simple code in the click event:
Dim strReportNameNew As String
Dim strReportNameOld As String
strReportNameNew = txtChangeTo.Text
strReportNameOld = txtChooseReport.Text
DoCmd.Rename strReportNameNew, acReport, strReportNameOld
The code fails with this error message:
Microsoft Visual Basic
Run-time error '29068'
Household Labels cannot complete this operation. You must stop the code and try again.
I am able to rename the report manually.I have searched but been unable to find out what is causing this error.
View 6 Replies
View Related
Dec 13, 2013
I'm using 2013. The first version of my code works great. It opens the correct report and attaches it to an e-mail as a pdf with all of my text etc.
Code:
Private Sub btnEMail_Click()
On Error GoTo errHandler
Dim strReport As String
Dim vMsg As String
Dim vSubject As String
Dim strWhere As String
strReport = "RptJobDSD"
[Code] ....
The problem I have is I would like to rename the pdf, so instead of "RptJobDSD" everytime, it can have some fields [DSDDate] and [JobID] etc.
Before trying the fancy field stuff I thought I'd try just "DSD Test" and see if I could rename it in the first place!
I added this and am getting - Error(32004) - The control name 'RptJobDSD' is misspelled or refers to a control that doesn't exist.
Code:
DoCmd.OpenReport strReport, acViewPreview, , strWhere
DoCmd.SetProperty strReport, acPropertyCaption, "DSD Test"
DoCmd.SendObject acSendReport, strReport, acFormatPDF, , , , vSubject, vMsg, True
My confusion comes as the OpenReport and SendObject recognise strReport why doesn't SetProperty?!
View 2 Replies
View Related
Jun 25, 2013
This code is supposed to loop around a directory of photos (named after a project), and then copy a new photos (from another directory) to this folder, numbering them and the logging them in a table tphotos.The first time a copy photos to a new directory the code works fine. And I think I had it working fine before, but now when I copy photos to a pre-existing directory that has already photos, it only overwrites the first photo, instead looking for the last photo and attributing the new photo number n+1.
I've done debug.print in the code, and it looks like is not going into If NewFileName = f1.Name, therefore doesn't compare the newfilename with the files in the folder.
Code:
Private Sub cmdAddPhoto_Click()
Dim fs, f, f1, fc, s
Dim fDial As FileDialog
Dim SourcefileName, destDir, FileExt, NewFileName, prjID As String
Dim intSel, FileNumber As Integer
Dim varSelFile As Variant
Dim rsPhoto As Recordset
Dim myDB As Database
[code]...
View 5 Replies
View Related
Jan 10, 2006
In MS Access , form,
how can write the VB for rename the table name?
If I created the table named "app"
then I made a button for rename the table to "aaa"
How can I write?
Thanks.
View 1 Replies
View Related
Dec 14, 2005
I've been asked to come up with a way (one-off) of renaming over 100 hundred tables. The table are all called "STUD_ADMIN_blah". We need to remove the "STUD_ADMIN_" part of the table name.
Is there a nice easy way of doing this without having to physically rename each table individually?
Thanks in advance.
Steve
View 14 Replies
View Related
May 23, 2012
I made the novice mistake of originally naming a field street #, so I changed it. I went to every place I thought it might affect and still it will not let me access my forms. Is there anyway to find all of the locations it might be and remove it? I am using Access 2010
View 1 Replies
View Related
Jul 25, 2005
Hopefully someone can help....
I'm trying to change the name of a column in a table using SQL. I've tried different combinations but always get
"Syntax error in Alter Table statement"
SQL I've tried
alter table tblImport
rename column F1 to [Date];*
alter tblImport
rename column F1 to [Date];
alter table tblImport
rename F1 to [Date];
I've checked this out via some SQL sites & think the first version (*) is correct....can someone throw light on this? I'm using Access2000
View 3 Replies
View Related
Jan 12, 2005
This is complex, but here goes.
I am copying many many music cds to my hard drive. However, the song file names on the cds are track01.mp3, track02.mp3, etc. I have all the real songnames for each cd listed in the database. I need a way to rename the songs with their real names one cd at a time. My thought was to populate one table with the directory and filenames (track--) of the songs and populate another table with real songnames from the database. Then, somehow, rename the files. I'm lost. I hope someone can help!
View 1 Replies
View Related
Apr 18, 2014
I was working on my DB, cleaning up some of the field name that were cumbersome and everything worked fine. Today I was doing some follow up work and I cannot change the field names. All I want to do it change the name of a field from CITY to City, but it won't let me do it. I have tried, change from single click to double click, but I was already using double click to open an object; unchecked Auto-Correct, still nothing.
Yesterday I was able to modify a name from Actions to Action (simply deleting one letter. And State/Province to StateProvince. Worked fine. What bothers me is that I have been able to change a field name before and now I can't. I have tried compact and restore, etc.
View 14 Replies
View Related
May 4, 2015
I made a Point of sale using a form with different sub-forms which have command buttons on it. They basically run a append query from tblStockMain to table cash and on to transactions. That works all fine no problem.
The one missing thing to make it sweet is to rename the command buttons automatically from tblStockMain. With other words, if I change a product in the table it would change the name on the button and the picture if possible with it.
Is there a way to do it?
View 2 Replies
View Related
Jan 5, 2014
I am still trying to copy an Excel file from a parent folder to a sub-folder, that this code creates, and name the copied file with the name used to name the sub-folder, using the name entered in a control field (named 'TheDirName) of an Access 2007 form. Here is my VBA, which names the copied file "TheDirName.xlsx.:
Private Sub MakeDir_Click()
Dim appExcel As Excel.Application
Dim lngLastDataRow As Long
Dim Folder_Path As String
'Create path for customer folder & files
[code]....
View 3 Replies
View Related
Jul 20, 2013
i need to auto rename a table and for each new time to create date in table name and after that to use query into i am asking if that is possible.
my 1 table name is kalktbl and second table name is kalkulacija.
query is select * into kalkulacija from kalktbl and i am renaming kalkulacija.
i am using visual basic.
View 11 Replies
View Related
Feb 22, 2006
Hello everyone.
I've been in a new position for a new company for less than three weeks, and I need some help.
The Access database that we use has been in operation since 2002, and it has never been Compacted/Repaired (I asked my coworkers and supposed IT people, and they said "what's that?").
After adding *one* new field, I've reached the horrific "error 3190" (max 255 fields).
I've tried all of the following, allowing at least 12 hours for them to run, but I cannot:
export the data to Excel
import the data into a new database
copy/paste the records (because there are 12100+ and the max is 9500, I think; and because of the way the dd/mm/yy converted itself to dd/mm/yyyy)
or rename the table with the data.
Please, someone help me.
View 1 Replies
View Related
Jan 8, 2007
Hi,
I would like to rename my access file. My problem: I have many pivot in excel link to this database so if i rename it all the links will be down...How can i resolve this?:confused: (of course rebuild all pivots could be a solution but I have around 50 pivots behind my database)
Thanks for your help!
View 1 Replies
View Related
Jul 17, 2015
I have the following piece of code for importing the .csv files from a selected folder and then renaming them into 'imported & filename' if succesful and 'failed & filename' if import failes for whatever reason (bad formating, etc.).
The problem is that the first time it encounters a 'bad' file after another, instead of going again to the Error handler, the command
Code:
DoCmd.TransferText acImportDelim, , "Activitate", filename, True
gives me the default MS Access error, namely 2391. I would like it to go the the Error_handler again ang follow the course of actions and rename the files into 'failed' and 'imported'.
Here's the code:
Sub ImportActivitate()
Dim strFile As String 'Filename's
Dim strFileList() As String ' File Array
Dim intFile As Integer 'Number of files
Dim filename As String, sFullName As String, sFilename As String
DoCmd.SetWarnings False
[code]....
Also, how can I make the routine stop cycling through the files after I renamed them all?
View 3 Replies
View Related
Mar 2, 2015
I have two tables.descriptions I'd like to relate and use to find/replace in bulk.
[Checking].[Description] (with the source data)
[Rename].[NewDescription] (with the correct data)
I'd like the values in [Checking].[Description] to be replaced with the values in [Rename].[NewDescription], including those that are "Like".
Examples:
[Checking].[Description] = Geico 12345
[Rename].[NewDescription] = Geico
[Checking].[Description] = Geic
[Rename].[NewDescription] = Geico
View 4 Replies
View Related
Jul 20, 2005
Is there a way to rename all my queries at teh sam time.
View 2 Replies
View Related
Oct 3, 2006
I have only started using acces recently. When working I have used strange names for queries forms and tables. I would like to "clean" the file and rename some items. I have found acces not to rename linked parts automatically. Is this possible? Thank you.
View 1 Replies
View Related
Jul 23, 2007
Hi guys,
I know this is pretty basic stuff but I MS Access is not my strong point.
I am looking to simply rename a table in MS Access 2003 using SQL, can anyone please help ?
There are no reports or queries attached to it.
Am I right in saying RENAME is not a reserved word in MS Access ?
Thanks.
View 4 Replies
View Related
Oct 23, 2005
Hi:
MS Access
In query:
I write
ALTER TABLE table_name
RENAME COLUMN old_name to new_name;
But, it doesn't work, because "Rename" is NOT avaliable.
How can I fix that?
Thanks.
View 1 Replies
View Related
Feb 8, 2007
Hi,
i want to rename a column name "id to concept_id" through sql query
please send me the query.
as soon as possible
thanks in advance..
View 7 Replies
View Related
Oct 22, 2004
I want to write a code to rename some files. the files names are xxxxxxx01.txt and i want to rename all the files in this directory to 01.txt,02.txt,03.txt can this be done by using VB in access?
View 4 Replies
View Related
Dec 17, 2007
Can i rename a control on the fly ? For example, if Me!Office = 6 Then Me.Branch9 = Me!Branch. Both branch9 and branch are fields in the table products
View 1 Replies
View Related