Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can a module inside a secured Access2000 DB be referenced??

Status
Not open for further replies.

bugnuts

Programmer
Mar 21, 2002
4
US
I am trying to make a stand-alone VB6 project run a procedure in a standard module that resides in a user-level secured Access2000 DB. I have tried DAO, ADO, and ADX, but apparently there is no way to trick any of them into running a procedure....Am I missing something in one of the data access methods...is there a way that I have not found using another system...or am I as doomed as doomed can be??? Any help is appreciated.
 
This is a little confusing. You mentioned something about running a procedure in a secured database and then you mentioned trying to trick DAO, ADO, and ADX. These do not run procedures (functions, subroutines) but maybe you meant stored procedures or SQL. It's all in how you set up the parameters for the connection. The following example from the access help for 'Connection' shows the:

uid (User ID)
pwd (Password)
database

cnn1.ConnectionString = "driver={SQL Server};" & _
"server=bigsmile;uid=sa;pwd=pwd;database=pubs"

Complete these an you will be able to connect to the database using ADO which will then allow you to access data.

Steve King Growth follows a healthy professional curiosity
 
The reason I was trying to use one of the data access methods is that I don't know of any other methods to refer to DB objects. That's what I meant by trying to "trick" DAO, ADO, etc....I was just looking for some method that might "see" the module. Does anyone know of a way to reference these code modules with methods other than data access?

Thanks again.
 
If it's just subs, functions, etc, have you tried setting a reference to the dB? If you set a reference to the dB then you can use it's functions/subs as well. Kyle [pipe]
 
Sorry...I should have been more specific. The process is meant to be automated (no logon dialog box, and if possible, not opening the Access app at all). Therefore, referencing the database itself really isn't what I'm looking for. I have tried using command strings to pass a userid/password and workgroup, but I can't seem to get the process to work all at once.

Thanks again
 
You are trying to write an application to automatically run a sub/Function in a secured Access database. Within that application, as Kyle has said, you need to reference the database. I'll guess that the application is being written in Microsoft Access but if it is in Visual Basic there is a parallel.

Open a module or create an empty module,
On the menu bar goto tools\references,
Locate the secured database which contains the function/sub and select it.

When you add a libary to the References dialog box, Access loads the database as a library when you make a call to the libary from your code. Call it just as you would any subroutine or function.

Growth follows a healthy professional curiosity
 
So if you go into Tools-->References from the Code desighn view can you click "Browse" and select the .mdb (or .mde) that you want to linke to?

Then you could just use the functions as if they were built in.

But I could be wrong, as I don't have a user-level secured dB here to test it on. On dB's that have a dB password set, this works fine. Kyle [pipe]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top