I'm not, though I wish I was!
The un-help files tell me that I can use Isloaded to determine if an object is loaded (duh), but it doesn't tell me what loaded actually means.
I'm trying to determine if a table has been deleted so I think Isloaded is not what I want - is there something like
If Tablename Exists Then....
Thanks in advance
Jim
5 1542
I'm not, though I wish I was!
The un-help files tell me that I can use Isloaded to determine if an object is loaded (duh), but it doesn't tell me what loaded actually means.
I'm trying to determine if a table has been deleted so I think Isloaded is not what I want - is there something like
If Tablename Exists Then....
Thanks in advance
Jim
Apparently there isn't so I modified this from elsewhere. - Function CheckExistsAndRename(strCurrentName As String, strNewName As String)
-
' check to see if the table exists, if it does then rename it
-
Dim dbNA As Database
-
Dim tdf As TableDef
-
Set dbNA = CurrentDb()
-
-
For Each tdf In dbNA.TableDefs
-
If tdf.Name = strCurrentName Then
-
DoCmd.Rename strNewName, acTable, strCurrentName
-
Exit Function
-
End If ' tdf.Name = strCurrentName
-
Next
-
-
End Function
Jim
NeoPa 32,556
Expert Mod 16PB
Try this Jim. - 'TableExists returns true if strName table exists.
-
Public Function TableExists(strName As String) As Boolean
-
TableExists = False
-
On Error Resume Next
-
TableExists = (CurrentDb.TableDefs(strName).Name = strName)
-
On Error GoTo 0
-
End Function
NeoPa 32,556
Expert Mod 16PB
BTW If you look up the OnOpen event in the Help system it will describe how objects are loaded - opened - closed - unloaded etc. It has the correct sequence all explained in there. I enclose a short excerpt :)
When you first open a form, the following events occur in this order:
Open ==> Load ==> Resize ==> Activate ==> Current
The Close event occurs after the Unload event, which is triggered after the form is closed but before it is removed from the screen.
When you close a form, the following events occur in this order:
Unload ==> Deactivate ==> Close
BTW If you look up the OnOpen event in the Help system it will describe how objects are loaded - opened - closed - unloaded etc. It has the correct sequence all explained in there. I enclose a short excerpt :)
Thank you again NeoPa, I suspected very strongly that Loaded was not what I was after. I was quite happy with the solution I nutted out although yours is, as usual, more elegant.
Thanks
Jim
NeoPa 32,556
Expert Mod 16PB
No worries Jim. Just throwing in some different ideas to chew over :)
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Jim Langston |
last post by:
I understand the rule of three, that if I have a custom constructor, copy or
destructor I probably need the other 2. My class object definately has a
custom constructor and destructor, but I'm...
|
by: Tony Williams |
last post by:
I have two tables 1.tblmonth which holds two fields txtmonth and txtqtrlabel
and 2. tblmain which holds a number of fields but in particular a field
called txtqtrlabel2. The two tables are linked...
|
by: Mark Richards |
last post by:
I have this code behind a report (same report as previous post);
Sub Report_Open(Cancel As Integer)
DoCmd.OpenForm "Report Date Range", , , , , acDialog, "Activity By
Location"
If Not...
|
by: bbdata |
last post by:
strange thing happened when i split my database.
i have a search form where you enter parameters, and get back filtered
records displayed on another form. when you close this one, theres a
code in...
|
by: eruanion |
last post by:
Hi, I've been working on this for a while now and I can't seem to find
out what is wrong with my code. I have 2 files one c3common.js which
only contains javascript functions for my main html page...
|
by: cp |
last post by:
I'm a Perl programmer by background, and JavaScript is dim second or
third choice. I have an AJAX application, and at one point in the code,
I need to be sure that an object has been created before...
|
by: billelev |
last post by:
Does anyone know if it is possible to close all objects in a database (tables, forms, queries etc.) using VBA code? I have not been able to find anything online to help me so far...
My motivation...
|
by: imrosie |
last post by:
Hello,
Is there anyone who can help me figure out how to resolve this conflict when I try to re-compile?
It keeps telling the sub or routine is not defined...but it is!?! I think (I'm a newbie)...
|
by: JohnHo |
last post by:
here is the deal I have a form with a command button to open another form. I would like to check if another form is loaded and use the code to close that form. simple right?
Dim obj As...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
| |