Showing posts with label wan. Show all posts
Showing posts with label wan. Show all posts

Tuesday, March 20, 2012

Access XP to SQL 7 Linked Tables

Basically, I want to 'link' the tables for record modifications, entries, et
c., so that the client (within a WAN) has the GUI front-end that he/she is a
ccustomed to (Access). ODBC seems old and slow, and I wanted to try somethi
ng new - ADO/ADOX/OLEDB? I
s there an easy way to make the connection, iterate through the tables (NOT
the sql system tables) that automatically includes the columns and maintains
that 'link' or connection while the AccessXP GUI front-end is open? This w
ould, of course, need to be
able to support multiple users at the same time.
Right now I get a "Compile error: user defined type not defined" on the fir
st line, but was hoping this was getting close...
THANK YOU!
(On-load event of start-up form.)
Public Function linkTables()
Dim oCat As ADOX.Catalog
Dim oTable As ADOX.Table
Dim sConnString As String
Dim avarSourceTables() As Variant
avarSourceTables = Array("dbo_tblHandouts", _
"dbo_tblParticipants", _
"dbo_tblSiteNetworks", _
"dbo_tblSubEvent", _
"dbo_tblSubReceivables", _
"dbo_xContacts", _
"dbo_xSites", _
"dbo_xTblEventStatus", _
"dbo_xTblNetwork", _
"dbo_xTblPartStatus", _
"dbo_xTblRate", _
"dbo_xTblRateSubType", _
"dbo_xTblReceivables", _
"dbo_xTblRequestors", _
"dbo_xTblRoomStyle", _
"dbo_xTblReports", _
"dbo_xTblSites", _
"dbo_xTblType")
' Set SQL Server connection string used in linked table.
sConnString = "ODBC;" & _
"Driver={SQL Server};" & _
"Server=servernameC;" & _
"Database=databasename;" & _
"Trusted_Connection=Yes;" & _
"Uid=oops;" & _
"Pwd=password;"
' Create a new Table object
For i = LBound(avarSourceTables) To UBound(avarSourceTables)
Set oTable = New ADOX.Table
With oTable
.Name = avarSourceTables(i)
Set .ParentCatalog = oCat
.Properties("Jet OLEDB:Create Link") = True
.Properties("Jet OLEDB:Remote Table Name") = avarSourceTables(i)
.Properties("Jet OLEDB:Link Provider String") = sConnString
End With
' Add Table object to database
oCat.Tables.Append oTable
oCat.Tables.Refresh
Next i
End Function
****************************************
******************************
Sent via Fuzzy Software @. http://www.fuzzysoftware.com/
Comprehensive, categorised, searchable collection of links to ASP & ASP.NET
resources...If you choose to use ADO you need to create your recordsets in code and not
rely on linked tables, which are not supported by ADO...
Steve
"Janet" <janetb@.mtn.ncahec.org> wrote in message
news:uTQj5tO4DHA.1644@.TK2MSFTNGP10.phx.gbl...
quote:

> Basically, I want to 'link' the tables for record modifications, entries,

etc., so that the client (within a WAN) has the GUI front-end that he/she is
accustomed to (Access). ODBC seems old and slow, and I wanted to try
something new - ADO/ADOX/OLEDB? Is there an easy way to make the
connection, iterate through the tables (NOT the sql system tables) that
automatically includes the columns and maintains that 'link' or connection
while the AccessXP GUI front-end is open? This would, of course, need to be
able to support multiple users at the same time.
quote:

> Right now I get a "Compile error: user defined type not defined" on the

first line, but was hoping this was getting close...
quote:

> THANK YOU!
>
> (On-load event of start-up form.)
> Public Function linkTables()
> Dim oCat As ADOX.Catalog
> Dim oTable As ADOX.Table
> Dim sConnString As String
> Dim avarSourceTables() As Variant
> avarSourceTables = Array("dbo_tblHandouts", _
> "dbo_tblParticipants", _
> "dbo_tblSiteNetworks", _
> "dbo_tblSubEvent", _
> "dbo_tblSubReceivables", _
> "dbo_xContacts", _
> "dbo_xSites", _
> "dbo_xTblEventStatus", _
> "dbo_xTblNetwork", _
> "dbo_xTblPartStatus", _
> "dbo_xTblRate", _
> "dbo_xTblRateSubType", _
> "dbo_xTblReceivables", _
> "dbo_xTblRequestors", _
> "dbo_xTblRoomStyle", _
> "dbo_xTblReports", _
> "dbo_xTblSites", _
> "dbo_xTblType")
> ' Set SQL Server connection string used in linked table.
> sConnString = "ODBC;" & _
> "Driver={SQL Server};" & _
> "Server=servernameC;" & _
> "Database=databasename;" & _
> "Trusted_Connection=Yes;" & _
> "Uid=oops;" & _
> "Pwd=password;"
> ' Create a new Table object
> For i = LBound(avarSourceTables) To UBound(avarSourceTables)
> Set oTable = New ADOX.Table
> With oTable
> .Name = avarSourceTables(i)
> Set .ParentCatalog = oCat
> .Properties("Jet OLEDB:Create Link") = True
> .Properties("Jet OLEDB:Remote Table Name") = avarSourceTables(i)
> .Properties("Jet OLEDB:Link Provider String") = sConnString
> End With
> ' Add Table object to database
> oCat.Tables.Append oTable
> oCat.Tables.Refresh
> Next i
> End Function
>
> ****************************************
******************************
> Sent via Fuzzy Software @. http://www.fuzzysoftware.com/
> Comprehensive, categorised, searchable collection of links to ASP &

ASP.NET resources...|||Thanks so much for the straight-forward answer Steve. Poop!-is my response.
But, at least I'm not getting things like "You need to make sure you've se
lected the right library." and I keep trying to tweak and search forever.
Thanks again. I'll go back to the odbc file dsn.
Speaking of which, what I thought I could avoid in the first place, I've got
the mdb on a file server and the sql odbc file dsn in the same folder. Two
people can open the file fine, but one gets an odbc failed error with no co
de or description. All are
running same os, same office version, with same version of sql odbc driver (
2000.81.9042.00)
Any clues?
****************************************
******************************
Sent via Fuzzy Software @. http://www.fuzzysoftware.com/
Comprehensive, categorised, searchable collection of links to ASP & ASP.NET
resources...|||"Janet" <janetb@.mtn.ncahec.org> wrote in message
news:u01g9bP4DHA.1816@.TK2MSFTNGP12.phx.gbl...
quote:

> Thanks so much for the straight-forward answer Steve. Poop!-is my

response. But, at least I'm not getting things like "You need to make sure
you've selected the right library." and I keep trying to tweak and search
forever.
quote:

> Thanks again. I'll go back to the odbc file dsn.
> Speaking of which, what I thought I could avoid in the first place, I've

got the mdb on a file server and the sql odbc file dsn in the same folder.
Two people can open the file fine, but one gets an odbc failed error with no
code or description. All are running same os, same office version, with
same version of sql odbc driver (2000.81.9042.00)
quote:

> Any clues?

Back when I was doing Access development, then migrated to Access - SQL
Server integration, I always preferred placing Access on the desktop for a
"true" client/server solution. While it takes more time, work, and testing
to get it right you'll have a far more robust solution.
If you have not discovered this book, I highly recommend getting this:
Microsoft Access Developer's Guide to SQL Server
by Andy Baron & Mary Chipman <SAMS>
ISBN: 0672319446
Steve

Monday, March 19, 2012

Access with SQL

We would like to have SQL connect with an Access database over a WAN.
Is the best way to use MSDE and allow SQL to connect directly to the
Access database or to convert this database every so often to SQL?
Thanks!
Ernie AdsettThe big question would be if you can get to the Access database at all over
the WAN, permission/security wise. For instance, you have a sqlserver
(server1) running under 'Joe' account and this account in no way can
access/connect to a remote computer (server2) due to windows permission, you
will not be able to get to the Access database.
If you can resolve the windows security issue, you can get to the Access
database either through a linked server (sp_addlinkedserver), ad-hoc
distributed query (opendatasource/openrowset). You can look these up in sql
book online for more info.
-oj
http://www.rac4sql.net
"Ernie Adsett" <ernie@.amt.nb.ca> wrote in message
news:POAPb.69773$IF6.1700881@.ursa-nb00s0.nbnet.nb.ca...
quote:

> We would like to have SQL connect with an Access database over a WAN.
> Is the best way to use MSDE and allow SQL to connect directly to the
> Access database or to convert this database every so often to SQL?
> Thanks!
> Ernie Adsett
>
|||To create a linked server to access an Access database
Execute sp_addlinkedserver to create the linked server, specifying Microsoft
.Jet.OLEDB.4.0 as provider_name, and the full path name of the Access .mdb d
atabase file as data_source. The .mdb database file must reside on the serve
r. data_source is evaluated
on the server, not the client, and the path must be valid on the server.
For example, to create a linked server named Nwind that operates against the
Access database named Nwind.mdb in the C:\Mydata directory, execute:
sp_addlinkedserver 'Nwind', 'Access 97', 'Microsoft.Jet.OLEDB.4.0',
'c:\mydata\Nwind.mdb'
To access an unsecured Access database, SQL Server logins attempting to acce
ss an Access database should have a login mapping defined to the username Ad
min with no password.
This example enables access for the local user Joe to the linked server name
d Nwind.
sp_addlinkedsrvlogin 'Nwind', false, 'Joe', 'Admin', NULL
To access a secured Access database, configure the registry (using the Regis
try Editor) to use the correct Workgroup Information file used by Access. Us
e the Registry Editor to add the full path name of the Workgroup Information
file used by Access to thi
s registry entry:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Je
t\4.0\Engines\SystemDB
After the registry entry is configured, use sp_addlinkedsrvlogin to create l
ogin mappings from local logins to Access logins:
sp_addlinkedsrvlogin 'Nwind', false, 'Joe',
'AccessUser', 'AccessPwd'
Access databases do not have catalog and schema names. Therefore, tables in
an Access-based linked server can be referenced in distributed queries using
a four-part name of the form linked_server...table_name.
This example retrieves all rows from the Employees table in the linked serve
r named Nwind.
SELECT *
FROM Nwind...Employees|||Is Access forming a front-end db for a SQL DB?
Would it not be possible to utilise some kind of web site (ASP) or similar.
It will run much faster over a WAN.
Or are you 'replicating' the SQL Server db to an AccessDB?
You dont need MSDE to connect to a SQL Server DB. MSDE is the 'desktop'
version of SQL Server.
Cheers,
James Goodman MCSE, MCDBA
http://www.angelfire.com/sports/f1pictures

Tuesday, March 6, 2012

Access table link to SQL question

I have a SQL 7 database I want to link to from Access 2000. Previously this
database could be linked to over our local network by way of a WAN link. We'
ve just moved and now that WAN link has been severed and so I'm forced to re
establish the table link ov
er the internet. The SQL server and website exist on the same box and when I
enter the public IP address of the server into the input field labeled "wha
t server do you want to connect to?" in DSN setup, it won't accept it. What
do I have to do to establis
h a dsn to a database over the internet as opposed to a local network?One option would be to add an entry to your host file for
the server and it's IP address. Then configure the DSN with
the server name you put in the host file for the server.
-Sue
On Thu, 18 Mar 2004 07:46:05 -0800, "Glenn"
<gvenzke@.equiguard.com> wrote:

>I have a SQL 7 database I want to link to from Access 2000.
>Previously this database could be linked to over our local network
>by way of a WAN link. We've just moved and now that WAN link
>has been severed and so I'm forced to reestablish the table link
>over the internet. The SQL server and website exist on the same
>box and when I enter the public IP address of the server into the
>input field labeled "what server do you want to connect to?" in DSN
>setup, it won't accept it. What do I have to do to establish a dsn to a
>database over the internet as opposed to a local network?