martinjward
Registered User.
- Local time
- Today, 13:54
- Joined
- Sep 28, 2007
- Messages
- 22
I have a process that will information into a recordset, to open the recordset naturally I need to get a handle on the current database.
I an attempting to create a sub that does nothing but get an handle on the current database so that if I need to make changes (i.e. split the database) I only need to change the code in a single place.
When I call the ConnectDB sub from my main routine it manages to connect to the database but when I return to the main routine the CUR_DB is empty as if it was never set.
Main Routine...
ConnectDB Routine...
Can someone please advise why I can not pass the database from the second sub back to the first please
Thanks in advanced
I an attempting to create a sub that does nothing but get an handle on the current database so that if I need to make changes (i.e. split the database) I only need to change the code in a single place.
When I call the ConnectDB sub from my main routine it manages to connect to the database but when I return to the main routine the CUR_DB is empty as if it was never set.
Main Routine...
Code:
Sub LogEntry()
Dim CUR_DB As Database
Call ConnectDB (CUR_DB)
<<Other Code to go in here>>
End Sub
ConnectDB Routine...
Code:
Public Sub CurrentDatabase(DB_CUR As Database)
Dim WS_DBCUR As Workspace
Dim STR_DBCUR As String
STR_DBCUR = CurrentProject.FullName
Set WS_DBCUR = CreateWorkspace("", "admin", "", dbUseJet)
Set DB_CUR = WS_DBCUR.OpenDatabase(STR_DBCUR, True)
End Sub
Can someone please advise why I can not pass the database from the second sub back to the first please
Thanks in advanced
Last edited: