|
-
Apr 28th, 2000, 11:24 PM
#1
I am currently writting a database application
I would like to take the code from my public module and place it into a dll for future programs... I recieve errors... Will I have to pass all values into the dll functions and return each set of values that I want to load into a form into a variable first for it to work properly?
Public strMsg
Public Cn As Connection
Public Rs As New Recordset
Public strJet As String
Public Function DBPath(dbName as string)
Dim strDBPath
strDBPath = App.Path
If Right(strDBPath, 1) <> "\" Then
strDBPath = strDBPath + "\" dbName +";Persist Security Info=False"
End If
strJet = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + strDBPath
End Function
Public Function OpenDb(strPath as String)
' Close an open connection
If Not (Cn Is Nothing) Then
Cn.Close
Set Cn = Nothing
End If
' Create a new connection Set Cn = New Connection
With Cn
' To connect to a SQL Server, use the following line:
' .ConnectionString="driver=[SQL Server];uid=admin;server=mysrv;database=site"
' For this example, we will be connecting to a local database
.ConnectionString = strPath
.CursorLocation = adUseClient
.Open
End With
End Function
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|