Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

rename current database 2

Status
Not open for further replies.

ameedoo3000

IS-IT--Management
Sep 20, 2016
233
EG
hi every body
how can i rename my current database after close it automaticly with vba code
 
combo,
Could these 2 lines:
Code:
Dim AccessApp As Access.Application
Set AccessApp = New Access.Application
be done in one line:
Code:
Dim AccessApp As [blue]New[/blue] Access.Application
[ponder]

---- Andy

"Hmm...they have the internet on computers now"--Homer Simpson
 
It seems that we have fallen far from the desired goal
Anyway, I will simplify things so that my goals become clear
On my desktop, I have two Access files, file A has no extension, and file B has the extension. All I want is him
1- Open file B through file A after changing its extension.
2- When you close file A, its extension is changed to no extension (automatically) to become as it was.
Is this possible or impossible?
 
I used to instantiate objects in the first way. I've heard that it works faster (after 'As New' declaration, in every call of object VB checks if the object is instantiated) and is safer (test with condition [tt]myObject Is Nothing[/tt] is always false).

combo
 
I tested this batch/cmd file using a link I posted much earlier.

Code:
@echo off
cd \data\access
REN Wordle.xxx Wordle.accdb

START  /wait "C:\Program Files (x86)\Microsoft Office\root\Office16\MSACCESS.EXE" "c:\data\access\Wordle.accdb"
REN Wordle.accdb Wordle.xxx

The code will change to the appropriate directory, rename the Access file, run the Access file, wait until the user exits the Access file, and renames the Access file.

Duane
Minnesota
Hook'D on Access
MS Access MVP 2001-2016
 
Thank you very much, my dear "dhookom".
It was a very perfect solution and exactly what I wanted.. Thank you very much.
 
Please.. How can no error message appear in error cases?
For example "file not found" error
 
Spell everything correctly. You could have a different location for your Access file. We can’t tell because you didn’t share anything.

Duane
Minnesota
Hook'D on Access
MS Access MVP 2001-2016
 
The recommended steps were implemented correctly and what was required was implemented successfully. I thank you for that. But there is a possibility that this file () will be stolen and run on another computer. Then an error message will appear explaining that the path or name of the file has changed, and thus the whole matter will be exposed. Therefore, I would like not to show any error message in the patch file code... That's all. I hope I made it clear
 
Again, it’s “batch”, not “patch”. You should be able to search the web for batch commands to do what you want. I searched to find your solution. I didn’t know anything about the WAIT command prior to reading your question.

Duane
Minnesota
Hook'D on Access
MS Access MVP 2001-2016
 
Thank you for correcting my spelling mistakes. Thank you for your effort
 
ameedoo3000 said:
But there is a possibility that this file () will be stolen and run on another computer.
If the file is critical, just password protect the database, so the file will be useless without knowing the password. You will also need a secure copy, to restore data if the file was destroyed/deleted.

combo
 
I remember doing a similar thing in Excel to attempt to make it foolproof for requiring the user to ENABLE MACROS. It takes a lot of thought and knowledge of the properties and methods of objects and Events.

The key was in the Save event, as I recall, to make the application appear to have only ONE useless sheet while all other sheets were very hidden. If the user ENABLED MACROS, the very hidden sheets were made visible. When the application would close, it would make all sheets but one very hidden before saving and closing. Didn't matter where it was saved.

Well one weak spot was that although the VBA was password protected, that could be cracked.

With user-friendly DIY applications like Access or Excel, they are thus vulnerable to tampering. You need an executable to distribute, that you generate from your personal master.



Skip,
[sub]
[glasses]Just traded in my OLD subtlety...
for a NUance![tongue][/sub]
"The most incomprehensible thing about the universe is that it is comprehensible" A. Einstein

You Matter...
unless you multiply yourself by the speed of light squared, then...
You Energy!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top