How can I use VBA ADO to check if a table exists in an Access DB?

Hi!

If I aready have an access DB called c:\temp\MyDb.mdb, is there any way
that I can use ADO to check if a table exists in this database?

Thanks,

Aijun.


-- 
Ai_Jun_Zhang
------------------------------------------------------------------------
Ai_Jun_Zhang's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=25474
View this thread: http://www.excelforum.com/showthread.php?threadid=397998

0
8/23/2005 1:20:29 AM
excel 39879 articles. 2 followers. Follow

3 Replies
413 Views

Similar Articles

[PageSpeed] 49

Here is a simple function. Call with

?IfTableExists("C:\temp\MtDB.mdb","DB")

Function IfTableExists(FileName As String, Table As String) As Boolean
Dim oConn As Object

  Set oConn = CreateObject("ADODB.Connection")
  oConn.Open = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & _
                FileName

  On Error Resume Next
  oConn.Execute "SELECT 1 FROM [" & Table & "] WHERE 0=1"
  IfTableExists = (Err.Number = 0)

  oConn.Close
  Set oConn = Nothing

End Function



-- 

HTH

RP
(remove nothere from the email address if mailing direct)


"Ai_Jun_Zhang" <Ai_Jun_Zhang.1u72ua_1124762703.1677@excelforum-nospam.com>
wrote in message
news:Ai_Jun_Zhang.1u72ua_1124762703.1677@excelforum-nospam.com...
>
> Hi!
>
> If I aready have an access DB called c:\temp\MyDb.mdb, is there any way
> that I can use ADO to check if a table exists in this database?
>
> Thanks,
>
> Aijun.
>
>
> -- 
> Ai_Jun_Zhang
> ------------------------------------------------------------------------
> Ai_Jun_Zhang's Profile:
http://www.excelforum.com/member.php?action=getinfo&userid=25474
> View this thread: http://www.excelforum.com/showthread.php?threadid=397998
>


0
bob.phillips1 (6510)
8/23/2005 8:51:31 AM
Thanks, Bob. It works and I really appreciate your help.

Bob, I have a side question. Is there any way this forum can notify me
by email if somebody has responded to my question? It will be very
convenient for me. Otherwise, as I am doing now, I have to check the
forum periodically to see if anybody has responded to my email.

Thanks,

Aijun.


-- 
Ai_Jun_Zhang
------------------------------------------------------------------------
Ai_Jun_Zhang's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=25474
View this thread: http://www.excelforum.com/showthread.php?threadid=397998

0
8/24/2005 6:57:00 PM
Hi Aijun,

I am afraid that I cannot help you with that question. I do not subscribe to
the forum, I connect to the Microsoft public newsgroups, where questions on
your forum are forwarded to. You would need to raise it there, but my
experience is that it's all or noting with these forums, you get an email
about all posts, or none.

Sorry I could not help more.

Bob


"Ai_Jun_Zhang" <Ai_Jun_Zhang.1ua8qd_1124910305.6801@excelforum-nospam.com>
wrote in message
news:Ai_Jun_Zhang.1ua8qd_1124910305.6801@excelforum-nospam.com...
>
> Thanks, Bob. It works and I really appreciate your help.
>
> Bob, I have a side question. Is there any way this forum can notify me
> by email if somebody has responded to my question? It will be very
> convenient for me. Otherwise, as I am doing now, I have to check the
> forum periodically to see if anybody has responded to my email.
>
> Thanks,
>
> Aijun.
>
>
> -- 
> Ai_Jun_Zhang
> ------------------------------------------------------------------------
> Ai_Jun_Zhang's Profile:
http://www.excelforum.com/member.php?action=getinfo&userid=25474
> View this thread: http://www.excelforum.com/showthread.php?threadid=397998
>



0
bob.phillips1 (6510)
8/24/2005 7:30:03 PM
Reply:

Similar Artilces:

Reporting from Project Server
I dont know if i need to ask this question here or in the Access section. I have an ODBC connection to the Project Server database so I can make reports through Access. Access' limit of 255 fields per table is causing me some trouble. for example, the MSP_VIEW_PROJ_PROJECTS_ENT table has well over 255 fields. Access only shows me the first 255 fields. how can I change that so I can see all the fields in that table? thanks, Hadi Hadi, I have not tried this yet it may be a viable option. Have your DBA create a view that pulls the key fields to this table and the specifi...

Formula without using numbers after decimal in the answer
I have a formula that derives the answer from a figure with a decimal. I don't want to use the figures after the decimal. Is there a way to just use the whole number and omit the numbers after the decimal without having to manually key in all these numbers manually? Thanks, Mustang You can use the INT function. This 'rounds down' any number to th nearest integer, e.g. if A1=2.567, a formula in B2 of =INT(A1) return 2 HTH Bruc -- swatsp0 ----------------------------------------------------------------------- swatsp0p's Profile: http://www.excelforum.com/member.php?...

Using Relative path for XML data file?
Is there a way to specify a relative path to an XML data file imported into Excel 2003? I am writing a web app that generates report data as XML for the user to download to their local machine. This data is to be consumed by an Excel reporting spreadsheet, which contains display-formatted tables and charts that are mapped to various data fields in an XML Map, which is in turn linked to the xml data file they will download. The idea is the user only needs to download the data for updates, not the whole spreadsheet. However, since I cannot predict the path where the user will store their...

Disable Secure Sockets Layer on exchange server when using RPC over HTTP
Hi im trying to enable RPC over HTTP to enable users to establish contact to my Excahger server 2003 over the internet. Now, I dont want to use SSL (security not that important) and i am told by this article that i can disable SSL in windows registry. Quote: Note While RPC over HTTP does not require Secure Sockets Layer, you must modify the registry to enable RPC over HTTP if you do not want to use Secure Sockets Layer. Microsoft recommends that you enable and require Secure Sockets Layer for your RPC over HTTP communications. At this address: http://support.microsoft.com/?id=833401 But i ...

Is anyone an expert with outlook that I can call on the phone?
How do I share calenders between outlook and my MSN Premier account? Assuming you are using the outlook connector, you need to set the msn account to be the default message store then outlook will use the msn calendar as the default. -- Diane Poremsky [MVP - Outlook] Outlook Tips: http://www.outlook-tips.net/ Outlook & Exchange Solutions Center: http://www.slipstick.com Outlook Tips by email: mailto:dailytips-subscribe-request@lists.outlooktips.net EMO - a weekly newsletter about Outlook and Exchange: mailto:EMO-NEWSLETTER-SUBSCRIBE-REQUEST@PEACH.EASE.LSOFT.COM You can access this...

using the journal on outlook
Once I link an email to the journal, can I still find that email in my mail box? I seem to be able to get to it only via the journal. If this is the way it is supposed to be, how do I remove it from the journal and get it back into my mail box? Am I just missing something? -- thanks, Independent Are you linking to the item or putting a copy into the journal item? Also, has the item been archived or not? "Independent" <Independent@discussions.microsoft.com> wrote in message news:868279F2-53C8-403A-97F5-604CEECD873C@microsoft.com... > Once I link an email to the journ...

eConnect Outgoing
We have a system that feeds Invoices into Payables Transactions in GP. GP is used to generate Payments (Checks) for these transactions. I'd like to use eConnect Outgoing services to read what check paid what invoices. I am able to get the check transaction pushed into the eConnect_Out table along with the invoices that are being paid. Though, I do not see a way to figure out which check paid what invoice. If anyone else has encountered this before, we will appreciate your input. Best Regards, RS ...

Pivot Table Question #5
How do I make the row headers show up in front of each row on pivot table instead of just once on the first row of a section? Thanks Try this: Copy the pivot table Do a Paste Special > Values into another sheet Ensure that the top left cell is A1 Run the Sub FillBlanks() below (from MVP Debra D) Sub FillBlanks() 'by Debra Dalgleish 7-Dec-2001 'fill blanks cells with data from above Range("A1").CurrentRegion _ .SpecialCells(xlCellTypeBlanks) _ .FormulaR1C1 = "=R[-1]C" Range("A1").CurrentRegion.Copy Range("A1").PasteS...

Access to User Calendar
I have a user called small conference room that is used to schedule meetings on its calendar. I would like to link the calendar from our intranet site to the calendar with a UNC path. I am calling outlook: and I can get to my local mailbox and public folders but I am unable to connect to another users calendar. I am running Exchange 2003 and Outlook 2003. Is there some security modifications that need to be done? Any help is appreciated. Thanks, Steve I believe that you will need full mailbox rights. -- Ed Crowley MVP - Exchange "Protecting the world from PSTs and brick backups!&...

Status in table PurchaseOrderEntryDetail
Hello, We're trying to populate serial # into the PurchaseOrderEntryDetail table and run across the column 'Status'. What are the possible values for Status column in this table? Most of the time we see status of '2'. What does that mean? Please help. Many Thanks & Best Regards, Nikki ...

Let me use the Line Color icon on charts
It would speed up a lot of my work if I could use the Line Color icon on Excel charts, the same way I am able to use the Fill Color and Font Color icons. However, when I highlight any chart object, like the Plot Area, Chart Area, or a Series, the Line Color icon is disabled. -- Stuart Bratesman, Jr., MPP Muskie School of Public Service Univ. of Southern Maine Portland, Maine ---------------- This post is a suggestion for Microsoft, and Microsoft responds to the suggestions with the most votes. To vote for this suggestion, click the "I Agree" button in the message pane. If ...

Table of Contents for each section
I have tried several times to create a TOC for each section of my document. They way it is now I can simply go to the Insert a TOC and it will insert e perfect TOC. All my text has been changed to the appropriate Level and I have no problem there. But I need to seperate the chapters to the start of their respective sections (I have next page breaks inserted at the start of every chapter). I have tried the bookmark method, no luck. I have tried other methods but I think my problem is that I have selected the appropriate fields and changed their levels appropriately. I have not mes...

microsoft.public.access.conversion
...

ACH Check Conversion at POS anybody doing this?
I am currently setting up Check verification or maybe we will use ACH check conversion. I would appreciate any advice or warnings from users who have tried and failed or tried and tried and tried and finally suceeded. We have been trying to get Positive and Abanco and Geti to get echeck verification running for 2 months still no luck. -- RMS 1.3, MSDE 3 Lanes, 5 Back Office Clients XP sp2 Server 2003 sp1 Domain Static IP ...

form fields not saving to table
I have created a database with a form and three of the fields are not saving the information to the table. I have checked the row and control sources and now at a loss and thoughts? As you scroll through existing records is the data of the table displayed? Post the SQL of the query or form source. -- Build a little, test a little. "Kim" wrote: > I have created a database with a form and three of the fields are not saving > the information to the table. I have checked the row and control sources and > now at a loss and thoughts? > > ...

How to set "licence" for Access 2007 database?
Hi I developed an Access 2007 db to a client. Now I want to make a year based licence for that database that the client must pay if they want to continue using the database after year. It must be so that database cannot be used after this date. How I can accomplish this? Thanks! On Mon, 12 Apr 2010 13:14:17 -0700 (PDT), Sandroid <santeri.virtanen@gmail.com> wrote: >Hi > >I developed an Access 2007 db to a client. Now I want to make a year >based licence for that database that the client must pay if they want >to continue using the database after year. It mu...

Does Outlook use the DAV protocol?
I'm an Outlook Express user who wants to switch to Outlook. I received a notice from Microsoft that includes the following: "... as of June 30, 2008, Microsoft is disabling the DAV protocol and you will no longer be able to access your Hotmail Inbox via Outlook Express." Please tell me if this action by Microsoft will affect Outlook in the same manner, or am I free to make the switch. "BudV" <BudVitoff@(NO)att.(SPAM)net> wrote in message news:%230XUDi%23zIHA.2384@TK2MSFTNGP02.phx.gbl... > I'm an Outlook Express user who wants to switch to Outlook...

Can I share entities in migration process?
The entities in CRM have only one owning user. If I want=20 who a user see a entity of another user, the entity must=20 be shared with this user.=20 Well, I want migrate entities who must be shared with some=20 users. Exists a way to do it? Thank you for pay attention and sorry my bad english. []'s Vin=EDcius Pitta Lima de Ara=FAjo ...

formula or VBA
I need to search through a column checking condtions. If the conditions are met, then I want to enter the corresponding value in the column next to it into a different cell. Basically, I want to search column A and, if the conditions are met, put the value in B into C. Would this be easier via formula or code? And maybe some starting suggestions would be nice if you don't mind. -- Thanks, Jim in a formula in col b =if(cond,a1,"") using vba for each c in range("a1:a100") if cond then c.offset(0,1)=c next -- Don Guillett SalesAid Software donaldb@281.com "...

Can't do adjustment in analytical accounting
I am trying to change an analytical assignmnet through the Edit Analysis. When I try and change it, I receive an error stating "The Code of this Transaction Dimension cannot be adjusted". Has anyone seen this before? I have done similar changes many times, but I don't know why I can't now. Any insight would be helpful. Thanks, KJ Hi KJ What version of Gp are you running? I haveseen this happen in 8 but one of the service packs fixed it. (I think it was SP 4 or 5) Fliehigh "KJ" wrote: > I am trying to change an analytical assignmnet through the Edit >...

Excel VBA
When you select the autofilter, the drop down list is created from the unique data in that column. Is there any way to customize this list, so the changes are permanent? For instance, I might have in one(1) column the following 4 row entries: red, blue, green (all are single cell entries) red, blue red blue, green I want my autofilter drop down list to read: red instead of red, blue, green blue red, blue green red blue, green (like normal) If I chose red from the drop down list...

Trouble in Save existing file
Hi there, I am using GetSaveFileName(), OnSaveDocument() to save configuration file of my application. Trouble is when I open existing file, edit, and try to save it as the same name, it compains like "Access to file was denied" and I can't save it. But it can be saved as a new name by SaveAs menu. One other thing is this trouble is happening only in Window2000 PCs. It just works well in Window 98. The application is developed in Windows 2000 and I am using Flags like OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST; Please help. Bob NZ >Hi there, I am using GetSaveFileName(), OnSaveD...

How can I create Schedule Chart?
I have simply an activity list which shows START and FINISH date of related activity. I need to put this information into a Chart, so that i will get a bar chart highligting the line between the START and FINISH date of the activity. It is very similar to what we can create in Microsoft Project. Do you know a specific chart type for this? It's called a Gantt chart: http://office.microsoft.com/en-us/excel/HA010346051033.aspx http://peltiertech.com/Excel/Charts/GanttLinks.html http://www.mrexcel.com/tip058.shtml -- David Biddulph "mezzanine1974" <savas_karaduman@yahoo.com>...

Problem with different versions of Access
Hello, I am working on a VBA Access pplication which connects to a SQL Server database. I have a continuous form displayed with data, ad it is linked to a database table, so when I enter a value from my form the data in instantaneously updated in the database. The problem I have is that this form works perfectly when I am developping, and using my developpement environement (with Access allowing me to set breakpoints, go step by step in the code and so on), but it does not work when I use it in the PC of the ending user : in this case, when I enter a value in the form, and click in a...

How can I change text to proper text in multiple cells.
I need to change names that are all in caps to proper case in 100 cells. If I click each one individually, it works, but I need to be able to perfomr this funcion automatically on all the cells. One other post said to be sure calc is set to automatic and mine is. Any instruction is most appreciated. Thank you. Insert a helper column to the right of the column with the names. Then use a formula like: =proper(a1) and drag down that column Then select that column edit|copy select the original range Edit|paste special|Values And then delete the helper column. bethye99 wrote: > > I...