
Newbie Application.Quit Question
Your problem is being caused right here,
--> Application.Quit <--
rs.Close
Set rs = Nothing
oConn.Close
Set oConn = Nothing
DoCmd.Close acForm, "frmOpener"
You're quiting w/o releaseing the recordset out of memory... Consider making
your sub a function and the Quiting something like this...
Private Sub Form_Load()
if fBirthdays then
MsgBox "You have Birthdays within 15 days."
DoCmd.OpenForm ("frmBirthDays")
Else
Application.Quit
Endif
End sub
Function fBirthdays as Boolean
Dim oConn As New ADODB.Connection
Dim myDB
fBirthdays = False ' To show there are no B'days
Set myDB = CurrentDb
oConn.Provider = "Microsoft.Jet.OLEDB.4.0"
oConn.ConnectionString = "data source = " & myDB.Name
oConn.Open
Dim rs
Set rs = New ADODB.Recordset
Dim msg As String
msg = "Select * from qryBirthDaysComing "
rs.Open msg, oConn, 1, 3
If not IsNull(rs) Then
fBirthays = True 'Birthday was found
End If
rs.Close
Set rs = Nothing
oConn.Close
Set oConn = Nothing
DoCmd.Close acForm, "frmOpener"
End Sub
--
-Francisco
Quote:
> Hi,
<SNIP>
>The problem is that after
> Access quits a dialog box pops up saying "Cannot find file....mydb
etc...".
> It seems like Access is closing so fast that it still wants to do
something
> but then since it did close it can't find what it needs. Any suggestions?
> Thank you,
> CS