[AccessD] Another really dumb question

Shamil Salakhetdinov shamil at users.mns.ru
Wed Apr 2 11:26:26 CDT 2008



<<<
you can't do this (to my knowledge) 
with SQL Server tables etc.
>>>
Hi John,

You can:

Dim serverName As String
Dim dataBaseName As String
Dim userName As String
Dim password As String

serverName = "COMPUTERNAME\SQLEXPRESS"
dataBaseName = "OnTime2008"
userName = "username"
password = "password"
Dim connectionString As String
    connectionString = "ODBC;Driver={SQL Native Client};Server={0};" + _
     "Database={1};Uid={2};Pwd={3};"
connectionString = Replace(connectionString, "{0}", serverName)
connectionString = Replace(connectionString, "{1}", dataBaseName)
connectionString = Replace(connectionString, "{2}", userName)
connectionString = Replace(connectionString, "{3}", password)

Dim rst As DAO.Recordset
Dim sql As String
sql = "select * from [Users] in '' [" + _
      connectionString + "]"
Set rst = CurrentDb.OpenRecordset(sql, dbOpenSnapshot)
While Not rst.EOF
    Debug.Print rst![userId] & " " _
       & rst![FirstName] + " " & _
       rst![LastName]
    rst.MoveNext
Wend
rst.Close
Set rst = Nothing

--
Shamil
 
-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of jwcolby
Sent: Wednesday, April 02, 2008 7:37 PM
To: 'Access Developers discussion and problem solving'
Subject: Re: [AccessD] Another really dumb question

That one's cool.  I use the IN "DatabaseName" clause in my libraries to be
able to fill combos and tables of forms stored in the library with data from
the application.  It took me awhile to figure that one out.  And of course
there are limitations such as "it only works with files", i.e. you can't do
this (to my knowledge) with SQL Server tables etc. 


John W. Colby
Colby Consulting
www.ColbyConsulting.com 
-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of
rusty.hammond at cpiqpc.com
Sent: Wednesday, April 02, 2008 11:22 AM
To: accessd at databaseadvisors.com
Subject: Re: [AccessD] Another really dumb question

One quick little trick to bypass the linked table if you're going to run an
append query anyway, is from the design view of a query, right click on the
query window and click properties.  Find the Source Database property and
type the path and filename of the mdb you want to copy records from, then
when you go to choose tables to add to your query, the list will show tables
from the source database you specified.



-----Original Message-----
From: Gary Kjos [mailto:garykjos at gmail.com]
Sent: Wednesday, April 02, 2008 10:15 AM
To: Access Developers discussion and problem solving
Subject: Re: [AccessD] Another really dumb question


Hi Barbara,

It depends on how many and how selective you need to be. You can copy and
paste individual records in table view. Or you can import an entire table
into another database using File/Get External Data/Import. Or you can attach
or link the table from the database you want to copy from in the database
you want to copy to and create an append query into the table you want the
records added to. that option gives you the ability to select records that
meet criteria as you would do for a report or whatever.

GK

On Wed, Apr 2, 2008 at 9:57 AM, Barbara Mende <barbara at moosehill.com> wrote:
> How do I copy records from one Access database to another?
>
>  Thanks!
>  Barbara
>
>  --
>  AccessD mailing list
>  AccessD at databaseadvisors.com
>  http://databaseadvisors.com/mailman/listinfo/accessd
>  Website: http://www.databaseadvisors.com
>



--
Gary Kjos
garykjos at gmail.com
--




More information about the AccessD mailing list