473,800 Members | 2,641 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Easiest Way to Find a Table

What is the easiest and simplest way to find out if a table exists in an
Access Data Project? (SQL Svr 2000 Standard using MS-Access 2003 for
connection.)

Mike Charney
m charney at dunlap hospital dot org
May 17 '06 #1
4 3842
"Mike Charney" <no*****@everyt hing.net> wrote in news:ueGag.7753 8$H71.48613
@newssvr13.news .prodigy.com:
What is the easiest and simplest way to find out if a table exists in an
Access Data Project? (SQL Svr 2000 Standard using MS-Access 2003 for
connection.)

Mike Charney
m charney at dunlap hospital dot org


Maybe:

Public Function DoesTableExist( ByVal TableName As String) As Boolean
DoesTableExist = Not CurrentProject. Connection.Open Schema
(adSchemaTables , Array(Empty, Empty, TableName)).BOF
End Function

But some mght want to use

sp_tables

or sp_tables_ex

--
Lyle Fairfield
May 17 '06 #2

"Lyle Fairfield" <ly***********@ aim.com> wrote in message
news:Xn******** *************** **********@216. 221.81.119...
"Mike Charney" <no*****@everyt hing.net> wrote in
news:ueGag.7753 8$H71.48613
@newssvr13.news .prodigy.com:
What is the easiest and simplest way to find out if a table exists in an
Access Data Project? (SQL Svr 2000 Standard using MS-Access 2003 for
connection.)

Mike Charney
m charney at dunlap hospital dot org


Maybe:

Public Function DoesTableExist( ByVal TableName As String) As Boolean
DoesTableExist = Not CurrentProject. Connection.Open Schema
(adSchemaTables , Array(Empty, Empty, TableName)).BOF
End Function

But some mght want to use

sp_tables

or sp_tables_ex

--
Lyle Fairfield

I am not real good with VB or VBA so I don't understand everything that is
going on in that statement. I do see that it is a separate module and I
really did not want to call or jump to another module and then back.

Is there a way to run an IF statement that checks for the table tblimport?

Mike
May 17 '06 #3
"Mike Charney" <no*****@everyt hing.net> wrote in
news:p0******** ***********@new ssvr29.news.pro digy.net:

"Lyle Fairfield" <ly***********@ aim.com> wrote in message
news:Xn******** *************** **********@216. 221.81.119...
"Mike Charney" <no*****@everyt hing.net> wrote in
news:ueGag.7753 8$H71.48613
@newssvr13.news .prodigy.com:
What is the easiest and simplest way to find out if a table exists
in an Access Data Project? (SQL Svr 2000 Standard using MS-Access
2003 for connection.)

Mike Charney
m charney at dunlap hospital dot org
Maybe:

Public Function DoesTableExist( ByVal TableName As String) As Boolean
DoesTableExist = Not CurrentProject. Connection.Open Schema
(adSchemaTables , Array(Empty, Empty, TableName)).BOF
End Function

But some mght want to use

sp_tables

or sp_tables_ex

--
Lyle Fairfield

I am not real good with VB or VBA so I don't understand everything
that is going on in that statement. I do see that it is a separate
module and I really did not want to call or jump to another module and
then back.


It's in whatever module you want to put it in. It is a separate function,
but you could easily extract the operating parts as something like:

If Not CurrentProject. Connection.Open Schema
(adSchemaTables , Array(Empty, Empty, "tblimport")).B OF Then

(this is all one line!)
Is there a way to run an IF statement that checks for the table
tblimport?


as above ... but the notion behind modular programming is that you put

Public Function DoesTableExist( ByVal TableName As String) As Boolean
DoesTableExist = Not CurrentProject. Connection.Open Schema
(adSchemaTables , Array(Empty, Empty, TableName)).BOF
'(this is all one line!)
End Function

in any standard module, including the one where you want to use it, and
then you can use it anytime anywhere in your project as simply

If DoesTableExist( "tblimport" ) Then

--
Lyle Fairfield
May 17 '06 #4

"Lyle Fairfield" <ly***********@ aim.com> wrote in message
news:Xn******** *************** **********@216. 221.81.119...
"Mike Charney" <no*****@everyt hing.net> wrote in
news:p0******** ***********@new ssvr29.news.pro digy.net:

"Lyle Fairfield" <ly***********@ aim.com> wrote in message
news:Xn******** *************** **********@216. 221.81.119...
"Mike Charney" <no*****@everyt hing.net> wrote in
news:ueGag.7753 8$H71.48613
@newssvr13.news .prodigy.com:

What is the easiest and simplest way to find out if a table exists
in an Access Data Project? (SQL Svr 2000 Standard using MS-Access
2003 for connection.)

Mike Charney
m charney at dunlap hospital dot org

Maybe:

Public Function DoesTableExist( ByVal TableName As String) As Boolean
DoesTableExist = Not CurrentProject. Connection.Open Schema
(adSchemaTables , Array(Empty, Empty, TableName)).BOF
End Function

But some mght want to use

sp_tables

or sp_tables_ex

--
Lyle Fairfield

I am not real good with VB or VBA so I don't understand everything
that is going on in that statement. I do see that it is a separate
module and I really did not want to call or jump to another module and
then back.


It's in whatever module you want to put it in. It is a separate function,
but you could easily extract the operating parts as something like:

If Not CurrentProject. Connection.Open Schema
(adSchemaTables , Array(Empty, Empty, "tblimport")).B OF Then

(this is all one line!)
Is there a way to run an IF statement that checks for the table
tblimport?


as above ... but the notion behind modular programming is that you put

Public Function DoesTableExist( ByVal TableName As String) As Boolean
DoesTableExist = Not CurrentProject. Connection.Open Schema
(adSchemaTables , Array(Empty, Empty, TableName)).BOF
'(this is all one line!)
End Function

in any standard module, including the one where you want to use it, and
then you can use it anytime anywhere in your project as simply

If DoesTableExist( "tblimport" ) Then

--
Lyle Fairfield


I understand now. I used the code that you listed and it worked great.

Thanks

Mike
May 17 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
11441
by: J Sharman | last post by:
What is the easiest way to import an XML Datafeed from a URL into a MYSQL Database? Possibly using PHP Regards Joe PS Please answer to group and joe@joesharman.co.uk
7
2692
by: Dan V. | last post by:
Situation: I have to connect with my Windows 2000 server using VS.NET 2003 and C# and connect to a remote Linux server at another company's office and query their XML file. Their file may be updated every hour or so. How can I do this easily? I would like to use secure communication even encryption if possible. I would query and insert locally only the newest records found in that XML file to an xml or MS access db.
4
1682
by: Captain Wonky | last post by:
As the subject says... I'm a database novice even though I've been trying to learn Access for years. I've 'almost finished' several databases but always get stumped on something - this time it's search fields (well, ONE of the things.. ). I'm creating a simple database to track various software licenses on various computers and I'd like to have a 'type and find' search field in a form. I can't seem to find out how to do this. All info...
6
5967
by: Ersin Gençtürk | last post by:
I can't find a expression for table views did i missed something ?
6
1854
by: jan | last post by:
My apologies for being a javascript beginner and asking such a basic question. This is probably so easy that nobody ever mentions it. Tutorials and places that tell of basic commands never seem to mention what I want to do. I've looked into SSI, shtml, external javascript, css, and html commands. There seems to be many solutions, but I would like to focus on using the best and easiest solution. I have a website with more than 1000 pages....
2
2397
by: lee | last post by:
Newbie question: I'm looking for the easiest way to run SQL statments in Access. I'm getting confused by th GUIs - I'm just looking forhow to run SQL on a table- thanks
5
2186
by: gnewsgroup | last post by:
In my user control, I would like to find a Label control in the parent page (the page that uses my user control). I need to update that Label.Text when something happens in the user control. I don't want to go through the hassle of creating events in the user control, and then let the parent handle the event. What is the easiest way to find a control in the parent page? Right now, I am simply manually traversing it from the user...
0
1120
by: dengel | last post by:
I'm a classic ASP/VbScript user, transitioning to c# and .NET. I'm making a little PW change utility which does this: 1. User inputs an email address/username (into a textbox) 2. User inputs their current Password(into a textbox) 3. User presses a submit button 4. Server checks the value of the text in the currentPassword textbox against the user's stored password in the DB. If they don't match, then it displays an error. 5. Else, a...
4
3989
by: Mudcat | last post by:
So I haven't programmed much in Python the past couple of years and have been catching up the last few days by reading the boards. I'll be making commercial Python applications again and wanted to see what's new in the Gui department. I started using Tkinter several years ago and have a lot of stuff written in it. As a result, it's hard to switch to another interface (wxPython, PyQt, etc) with all the hours it would take to reproduce...
0
9690
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
1
10251
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10033
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7576
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6811
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5606
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4149
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3764
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2945
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.