Re: Delete an Access query using VB code
From: Al Reid (areidjr_at_reidDASHhome.com)
Date: 01/21/05
- Next message: cclark: "DAO on users computers"
- Previous message: BOB: "Re: Delete an Access query using VB code"
- In reply to: bob bonehead: "Delete an Access query using VB code"
- Next in thread: Douglas J. Steele: "Re: Delete an Access query using VB code"
- Reply: Douglas J. Steele: "Re: Delete an Access query using VB code"
- Messages sorted by: [ date ] [ thread ]
Date: Fri, 21 Jan 2005 11:03:02 -0500
Bob,
This is easily accomplished via ADO. Look at the OpenSchema Method of the connection object. You can retrieve a list of views and
determine if the view exists.
Alternatively, you can just drop the view and either handle the error that is thrown if it does not exist, or ignore it.
Create a connection and Execute the DDL Statements.
cnn.Open
cnn.Execute "DROP VIEW TEST"
cnn.Execute "CREATE VIEW TEST AS " & _
"SELECT Field1, Field2, Field3 " & _
"FROM MyTable " & _
"WHERE Field4 = 'Y' = 2;"
In fact, you can execute any valid SQL DDL statements to create, drop, truncate and alter tables, create views, stored procedures,
etc. through ADO.
If you have any specific questions, post back.
-- Al Reid "It ain't what you don't know that gets you into trouble. It's what you know for sure that just ain't so." --- Mark Twain "bob bonehead" <bob@bonehead.com> wrote in message news:O2DHR52$EHA.2552@TK2MSFTNGP09.phx.gbl... > Hello everyone, > > I hope I posted this to the newsgroups correctly. > > My question is this. I have an access database with a query in it that needs > to be updated. There is a bug in it so we need to write VB code to go out to > the database, find the query if it exists, delete it and create a new one. > > How can this be done? If it where just one database, we could update it > manualy but there are about 60 copies of it floating arount the state of > Pennsylvania, making it hard to get everyone of them in to update, so we > will send a service pack out with the database update in it, if we can do > what we need to do. > > Thanks > > Dunnie > >
- Next message: cclark: "DAO on users computers"
- Previous message: BOB: "Re: Delete an Access query using VB code"
- In reply to: bob bonehead: "Delete an Access query using VB code"
- Next in thread: Douglas J. Steele: "Re: Delete an Access query using VB code"
- Reply: Douglas J. Steele: "Re: Delete an Access query using VB code"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|