BE DB Connection problem

IpeXeuS

Registered User.
Local time
Today, 09:15
Joined
Nov 23, 2006
Messages
98
Hi there, :cool:

I've a bit problem with connecting to my backend database on server.

I've a form that read's backend path to hidden text field with openargs in onload event. Then I've "OpenBackEnd True" code when form opens and "OpenBackEnd False" when form closes. I use code below:

Code:
Public Sub OpenBackEnd(X)
On Error GoTo Err_Handler

    Dim dbOpen() As DAO.Database

    If X = True Then
        Set dbOpen(X) = DBEngine.Workspaces(0).OpenDatabase(strFullBE, False, False)
    Else
        dbOpen(X).Close
    End If
    
Exit_Handler:
    Exit Sub
Err_Handler:
    MsgBox Err.Description
    Resume Exit_Handler
End Sub

But when I try to connect to database, there comes this error message:

Code:
Subscript out of range.

So if you gurus have any suggestions what I should do to make this right, please I'm glad to read your replies and all are approciated a lot. Thanks for advance... :)
 
Hi there, :cool:

I've a bit problem with connecting to my backend database on server.

I've a form that read's backend path to hidden text field with openargs in onload event. Then I've "OpenBackEnd True" code when form opens and "OpenBackEnd False" when form closes. I use code below:

Code:
Public Sub OpenBackEnd(X)
On Error GoTo Err_Handler

    Dim dbOpen() As DAO.Database

    If X = True Then
        Set dbOpen(X) = DBEngine.Workspaces(0).OpenDatabase(strFullBE, False, False)
    Else
        dbOpen(X).Close
    End If
    
Exit_Handler:
    Exit Sub
Err_Handler:
    MsgBox Err.Description
    Resume Exit_Handler
End Sub

But when I try to connect to database, there comes this error message:

Code:
Subscript out of range.

So if you gurus have any suggestions what I should do to make this right, please I'm glad to read your replies and all are approciated a lot. Thanks for advance... :)


This line
Code:
Dim dbOpen() As DAO.Database

is creating an array of databases, is that what you want? If so you need to dimension the array before you try to set it.

Code:
Redim dbOpen(lowerBound to upperBound)

But I'm guessing you don't need an array so just use this

Code:
Dim dbOpen As DAO.Database

Set dbOpen = DBEngine.Workspaces(0).OpenDatabase(strFullBE, False, False)
 
Ok mate, I'll give it a try and report here how did it go, ok. :)
 
I tryied that solution u suggest last one and that error message what I mention earlier is gone, but now there coming this error message when I'll try to close that database connection, what I opened when form opened:

Code:
Object variable or with block variable not set
 

Users who are viewing this thread

Back
Top Bottom