473,406 Members | 2,769 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,406 software developers and data experts.

Create Table / Modify Table in remote database

I'm using Access XP.

I'm trying to create a table, modify a table, create in index, and create a
relationship in a remote database in code from the program database.

I know how to create and manipulate resident tables using code but not a
remote or attached database.

Any help you could provide would be greatly appreciated

Thank you!
Jo
Nov 13 '05 #1
2 4949
You need to open the remote database as an object.

Dim objAcc As Access.Application
Dim extDB As DAO.Database
Set objAcc = GetObject(strRemoteDB_FileName)
Set extDB = objAcc.CurrentDb
From there, you can do anything you need to do in extDB (the "remote"

database) as if it was the local database. Just remember to preface
your commands with "extDB." or "objAcc." (depending upon what level you
need to operate at) so Access doesn't try to do it in the local DB.

objAcc.DoCmd.DeleteObject <whatever>
or
extDB.Execute <SQL string>,dbFailOnError

As always, remember to close and set to nothing your objects.

Oh, and a warning... Remember to make a _copy_ of the remote database
before doing anything to it! This will give you a chance to abort
whatever you are doing if (when!) something unexpected happens (and
experience says: it will.)

Nov 13 '05 #2
Thanks Chuck, I'll give that a try.
"Chuck Grimsby" <c.*******@worldnet.att.net> wrote in message
news:11**********************@g49g2000cwa.googlegr oups.com...
You need to open the remote database as an object.

Dim objAcc As Access.Application
Dim extDB As DAO.Database
Set objAcc = GetObject(strRemoteDB_FileName)
Set extDB = objAcc.CurrentDb
From there, you can do anything you need to do in extDB (the "remote"

database) as if it was the local database. Just remember to preface
your commands with "extDB." or "objAcc." (depending upon what level you
need to operate at) so Access doesn't try to do it in the local DB.

objAcc.DoCmd.DeleteObject <whatever>
or
extDB.Execute <SQL string>,dbFailOnError

As always, remember to close and set to nothing your objects.

Oh, and a warning... Remember to make a _copy_ of the remote database
before doing anything to it! This will give you a chance to abort
whatever you are doing if (when!) something unexpected happens (and
experience says: it will.)

Nov 13 '05 #3

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

Similar topics

9
by: jab | last post by:
Je veux lier (join) une table qui se trouve dans une database avec une qui se trouve dans une autre database. Les 2 databases sont sur le même serveur en l'occurence DB2/NT 7.2.9. J'ai créé un...
3
by: blindsey | last post by:
Is there a tool that can take an Access database and generate SQL "CREATE TABLE" statements for all the tables in it?
3
by: MLH | last post by:
I was running the following code while logged in as a user belonging only to the Users group. Set usrNew = .CreateUser(Me!UserID) 'The user ID is in a control on the form usrNew.PID =...
9
by: Bob Achgill | last post by:
I would like to use the timestamp on files to manage the currency of support files for my VB windows application. In this case I would only put the timestamp of the file in the management database...
9
by: Peter | last post by:
Hello£¬everyone, My program will collect a testing machine's data ,save the data and deal with the data everyday. I want to use vb.net to create database, add and delete tables or modify the...
4
by: Wayne Wengert | last post by:
I am trying to create a VB.NET Windows application to move some data from a local Access DB table to a table in a SQL Server. The approach I am trying is to open an OLEDB connection to the local...
3
by: fritz-bayer | last post by:
Hi, is it possible to create remote virtual tables in mysql? By that I mean if it is possible to define a table, which actually resides on a remote mysql server, but which can be accessed and...
4
by: eSolTec, Inc. 501(c)(3) | last post by:
Thank you in advance for any and all assistance. Here is my problem. I have a program that will create a registry key, however it is not and here is the code and also the error that follows: ...
11
by: raylopez99 | last post by:
Keep in mind this is my first compiled SQL program Stored Procedure (SP), copied from a book by Frasier Visual C++.NET in Visual Studio 2005 (Chap12). So far, so theory, except for one bug...
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?
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
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.