Mcgillivray, Donald [ITS]
donald.a.Mcgillivray at mail.sprint.com
Fri Sep 19 12:42:34 CDT 2003
Thanks, Drew! That's gonna get me there. Thanks, too, to all the others who responded to my post. Don -----Original Message----- From: Drew Wutka [mailto:DWUTKA at marlow.com] Sent: Friday, September 19, 2003 8:58 AM To: 'Access Developers discussion and problem solving' Subject: RE: [AccessD] Retrieving data from a secured remote db Function fDatabaseConnection(CurrCnn As ADODB.Connection, UserName As String, PassWord As String) Set CurrCnn = New ADODB.Connection With CurrCnn .Provider = "Microsoft.Jet.OLEDB.4.0" .Properties("Jet OLEDB:System database").Value = "T:\AccessDB\ISReq\Marlow1.mdw" .Open "T:\AccessDB\ISReq\ISReqBE.mdb", UserName, PassWord End With End Function To use the function above, here's an example: Dim cnn as ADODB.Connection Dim rs as ADODB.Recordset Dim strSQL as String fDatabaseConnection cnn,"UserName","Password" Set rs=new ADODB.recordset strSQL="Select * From tblData;" rs.open strSQL,cnn,adOpenKeyset,adLockReadOnly if rs.EOF=false then rs.MoveFirst Do until rs.EOF=True 'Do something rs.MoveNext Loop rs.Close Set rs=nothing cnn.Close set cnn=Nothing Just a little sample code. I know this code uses ADO, which is the default in A2k, but in A97, DAO is default. DAO is the native language for Jet databases, but I find that ADO is FAR more flexible. I can write code for connecting to an Access database, and later on, if I change the data source, I just have to modify the connection routine. Drew -----Original Message----- From: Mcgillivray, Donald [ITS] [mailto:donald.a.Mcgillivray at mail.sprint.com] Sent: Thursday, September 18, 2003 6:04 PM To: Access Developers discussion and problem solving Subject: RE: [AccessD] Retrieving data from a secured remote db Thanks, Drew Well, either linking or grabbing the data - makes little difference to me. I'm planning to secure the new db, in case that complicates your first scenario any. Don't really like the idea of enabling the Admin account if I can avoid it. Can you point me in the direction of establishing a connection via code? Been studying the help(less) and don't see an example for what I'm aimed at. Thanks! Don -----Original Message----- From: Drew Wutka [mailto:DWUTKA at marlow.com] Sent: Thursday, September 18, 2003 3:19 PM To: 'Access Developers discussion and problem solving' Subject: RE: [AccessD] Retrieving data from a secured remote db Okay, and you just want to retrieve data from it? Do you want a linked table, or not? If you have a table, that you want to allow access to, you should be able to set read permissions on a table, for the Admin account, which is the 'default' account used for unsecure databases. You'll have to give the admin account permissions to open the database too. If you don't want to go that route, with linking a table, you could just use ADO/DAO code, to connect to the db using the appropriate .mdw file, to retrieve the data (the unbound method)! grin. Of course this would put the account and password in the source, so you would probably want to restrict access to the source (.mde). Drew -----Original Message----- From: Mcgillivray, Donald [ITS] [mailto:donald.a.Mcgillivray at mail.sprint.com] Sent: Thursday, September 18, 2003 5:05 PM To: Access Developers discussion and problem solving Subject: RE: [AccessD] Retrieving data from a secured remote db Drew, It's just an .mdb on a network drive. Don -----Original Message----- From: Drew Wutka [mailto:DWUTKA at marlow.com] Sent: Thursday, September 18, 2003 2:54 PM To: 'Access Developers discussion and problem solving' Subject: RE: [AccessD] Retrieving data from a secured remote db What exactly do you mean by remote? Are we talking about an .mdb on a network drive, or are we talking about an .mdb somewhere on the internet? Drew _______________________________________________ AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com _______________________________________________ AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com _______________________________________________ AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com _______________________________________________ AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com