sphere_monk
Registered User.
- Local time
- Yesterday, 19:45
- Joined
- Nov 18, 2002
- Messages
- 62
Hi everyone,
I have two databases. One is a billing database that has customer account info in it. The other is a contact management database to record phone calls as they occur.
Employees usually have the customer account form in the Billing db already loaded when a call comes in. I would like them to be able to hit an 'Enter Call' button that does the following:
The problem is that with this code, the Contact database gets opened repeatedly, every time the 'Enter Call' is clicked. Does anyone know how to evaluate whether the db is already loaded? Or maybe there an altogether easier way to accomplish this?
Thanks,
I have two databases. One is a billing database that has customer account info in it. The other is a contact management database to record phone calls as they occur.
Employees usually have the customer account form in the Billing db already loaded when a call comes in. I would like them to be able to hit an 'Enter Call' button that does the following:
- Evaluates whether the Contact db is open already
- If it is, it loads the 'Enter Call' screen
- If it isn't, it opens the Contact db and opens the 'Enter Call' screen
Code:
Private Sub cmdEnterCall_Click()
On Error GoTo Err_cmdEnterCall_Click
Dim appAccess As Access.Application
Dim rst As New ADODB.Recordset
Dim cnn As ADODB.Connection
Set cnn = CurrentProject.Connection
rst.Open "SELECT Filename FROM SharedLiveFEDatabases " & _
"WHERE DatabaseName = 'ContactFE'", cnn
rst.MoveFirst
Set appAccess = CreateObject("Access.Application")
' Open database in Microsoft Access window.
appAccess.OpenCurrentDatabase rst!FileName
' Open Enter Call form.
appAccess.DoCmd.OpenForm "frmContactEnterCall"
Exit_cmdEnterCall_Click:
Exit Sub
Err_cmdEnterCall_Click:
MsgBox Err.Description
Resume Exit_cmdEnterCall_Click
End Sub
The problem is that with this code, the Contact database gets opened repeatedly, every time the 'Enter Call' is clicked. Does anyone know how to evaluate whether the db is already loaded? Or maybe there an altogether easier way to accomplish this?
Thanks,