English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

I'm just starting to program in Access 2003 and need to know how I can use a form to open a separate database.
Thx

2007-03-01 09:26:09 · 4 answers · asked by david2131uk 1 in Computers & Internet Programming & Design

I'm using Access 2003 and need to alter the code on a standard form from opening something like another form to opening a separate database.

2007-03-01 09:50:46 · update #1

4 answers

Like the others say use the ADO object

VBA code would be something like;
Set cnnAdo = CreateObject("ADODB.Connection")
cnnAdo.ConnectionString = ""
cnnAdo.Open

-- cnnAdo is now an open connection to the other database
-- to open a recordset use

Set rsAdo = CreateObject("ADODB.Recordset")
rsAdo.Open "", cnnAdo, 0, 1

-- The 0 & 1 indicate forwardonly and readonly
-- (Change this if you want)

Do While Not rsAdo.EOF
-- Your code on the recordset here
rsAdo.MoveNext
Loop

rsAdo.Close
cnnAdo.Close
Set rsAdo = Nothing
Set cnnAdo = Nothing



Remember if Option Explicit you need to define the Objects first

Hope this helps

2007-03-01 10:00:08 · answer #1 · answered by id36uk 3 · 0 0

Not sure what language you are writting in. But anyway you will need an ADO object an Oledb connection or something ( a connection string and connect to the database), a command( the query or whatever you want to perfom on the data table) and an execution call to execute the command. Search for ADO.Net you should find some tutorials.

2007-03-01 09:34:38 · answer #2 · answered by joec_11 3 · 0 0

Using a system ODBC connection to the database.

Start > Control Panel > Administrative Tools > Data Sources

2007-03-01 09:31:47 · answer #3 · answered by blndchik 5 · 0 0

my guess would be by adding an ADO.NET object to that form, connect to the database and access the tables in it

2007-03-01 09:31:36 · answer #4 · answered by Muhammed 3 · 0 0

fedest.com, questions and answers