473,398 Members | 2,389 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

IsLoaded

JustJim
407 Expert 256MB
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
Nov 11 '07 #1
5 1542
JustJim
407 Expert 256MB
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.

Expand|Select|Wrap|Line Numbers
  1. Function CheckExistsAndRename(strCurrentName As String, strNewName As String)
  2. ' check to see if the table exists, if it does then rename it
  3. Dim dbNA As Database
  4. Dim tdf As TableDef
  5. Set dbNA = CurrentDb()
  6.  
  7. For Each tdf In dbNA.TableDefs
  8.     If tdf.Name = strCurrentName Then
  9.         DoCmd.Rename strNewName, acTable, strCurrentName
  10.         Exit Function
  11.     End If  '   tdf.Name = strCurrentName
  12. Next
  13.  
  14. End Function
Jim
Nov 11 '07 #2
NeoPa
32,556 Expert Mod 16PB
Try this Jim.
Expand|Select|Wrap|Line Numbers
  1. 'TableExists returns true if strName table exists.
  2. Public Function TableExists(strName As String) As Boolean
  3.   TableExists = False
  4.   On Error Resume Next
  5.   TableExists = (CurrentDb.TableDefs(strName).Name = strName)
  6.   On Error GoTo 0
  7. End Function
Nov 12 '07 #3
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
Nov 12 '07 #4
JustJim
407 Expert 256MB
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
Nov 12 '07 #5
NeoPa
32,556 Expert Mod 16PB
No worries Jim. Just throwing in some different ideas to chew over :)
Nov 12 '07 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

4
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...
9
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...
3
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...
1
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...
39
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...
2
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...
7
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...
7
imrosie
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)...
15
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
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...
0
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...
0
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...
0
Oralloy
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,...
0
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...
0
agi2029
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,...
0
isladogs
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...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.