01-09-2001, 07:53 AM
I am new to VB and here is my problem. I have a Acc97 db that uses a mdw security file for table security. I am trying to use a Data Control on a VB form to connect to the Acc97 db. How do I point the connection for the Data Control to the mdw file? I keep getting a "no permissions" error because it is not using the mdw file? I want to use the Data Control as I am new to VB and it seems to be the easiest to connect to Access. However, I cannot find any documentation in the MSDN that covers this?
01-10-2001, 09:09 PM
Well, I can't blame you wanting to use the data control, being new to VB and all, but I found it to be WAY too limiting. It's really not that hard at all to use ADO, especially if you are already familiar with Access. I "cheat" by creating my sql in Access (which works great MOST of the time) and using that to access my tables. If you are willing to take a chance and dive right in, here is some code for the connection that PWNettle gave me (see the post a few lines down) that works GREAT for mdw files. I would like to see someone get use out of it since I used another type of security, and besides, if you still REALLY want to use a data control, then this will at least put you to the top of the list :)
And I quote:
Dunno if this will help, but we use the ADO setup below to get into an access secured (.mdw) access database of ours.
conYourConnectionObject.ConnectionString = "Provider=Microsoft.Jet.OLEDB.3.51" conYourConnectionObject.Properties("Jet OLEDB:System database") = "c:\pathto\your.mdw" conYourConnectionObject.Properties("User ID") = "WhateverUsername" conYourConnectionObject.Properties("Password") = "WhateverPassword" conYourConnectionObject.Open "Data Source=c:\pathto\your.mdb"
You could probably combine the ConnectionString and Open arguments (that's the way I usually do opens) - this source was provided to me by my coworker who figured out how to do this after much experimentation and hair pulling. He sets up his ADO a little differently than I do. The main thing with this is that you can't just put the username and password in the connection string - you have to first let ADO know where the security file is and set it all up through (very obscure) properties.
Hope it helps!