Hello,

Sorry about the strange Title. Here is the scenerio.

On a Form_Load of a form that is launched from another form

Code:
Private Sub cmdShowBidForm_Click()
    frmJobBid.Show vbModeless
End Sub
the first thing that the form does is connect to a database, and load some comboboxes. BUT... if the connection to the Database fails or the recordset returns no values, I want to simply display a message "Error loading form due to ..." and then return to the previous form that initiated the call.

I run into the following issue, and I would like to see what other people have done to handle similiar situations.

here is the code that I am currently using to unload the form
Code:
Private Sub LoadQBCustomersJobs()
Dim oRS As ADODB.Recordset
Dim sSql As String

sSql = "SELECT QBCustomerListID, QBName, QBJobFullName, QBJobParentListID FROM QBCustomers"

Set oRS = LoadRS(sSql)
If oRS Is Nothing Then
    MsgBox "No customers are in the database. exiting form."
    unload me
    Exit Sub
End If

    oRS.MoveLast
    MsgBox oRS.RecordCount
    
    '---... load Combos etc
End Sub
thanks,


Steve