473,320 Members | 1,746 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,320 software developers and data experts.

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 3791
"Mike Charney" <no*****@everything.net> wrote in news:ueGag.77538$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.OpenSchema
(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.8 1.119...
"Mike Charney" <no*****@everything.net> wrote in
news:ueGag.77538$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.OpenSchema
(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*****@everything.net> wrote in
news:p0*******************@newssvr29.news.prodigy. net:

"Lyle Fairfield" <ly***********@aim.com> wrote in message
news:Xn*********************************@216.221.8 1.119...
"Mike Charney" <no*****@everything.net> wrote in
news:ueGag.77538$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.OpenSchema
(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.OpenSchema
(adSchemaTables, Array(Empty, Empty, "tblimport")).BOF 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.OpenSchema
(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.8 1.119...
"Mike Charney" <no*****@everything.net> wrote in
news:p0*******************@newssvr29.news.prodigy. net:

"Lyle Fairfield" <ly***********@aim.com> wrote in message
news:Xn*********************************@216.221.8 1.119...
"Mike Charney" <no*****@everything.net> wrote in
news:ueGag.77538$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.OpenSchema
(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.OpenSchema
(adSchemaTables, Array(Empty, Empty, "tblimport")).BOF 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.OpenSchema
(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
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
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...
4
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...
6
by: Ersin Gençtürk | last post by:
I can't find a expression for table views did i missed something ?
6
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...
2
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
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...
0
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...
4
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...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.