Okay rookery.....here is you code.....
place this in a module and save it. After doing your check to see which database you want to save, merely assign the variables during the call as necessary. You will also nee to look at comments in the code to finish it off to your specifications...
the call is as such...
Connect2Database("C:\My Documents\test.mdb", "tblTest"
Let me know if you need anymore help.
'********* Start Code ***************
Option Compare Database
Option Explicit
'Define the API calls
Private Declare Function apiSetForegroundWindow Lib "user32" _
Alias "SetForegroundWindow" _
(ByVal hwnd As Long) _
As Long
Private Declare Function apiShowWindow Lib "user32" _
Alias "ShowWindow" _
(ByVal hwnd As Long, _
ByVal nCmdShow As Long) _
As Long
Private Const SW_MAXIMIZE = 3
Private Const SW_NORMAL = 1
Public Function Connect2Database(strMDB As String, strTable As String) As Boolean
'strMDB is the full path to the database, strTable is the table name in the database
On Error GoTo ErrorHandler
Dim objAccess As Access.Application
Dim lngRet As Long
Dim db As Database
Dim rs As Recordset
If Len(Dir(strMDB)) > 0 Then
Set objAccess = New Access.Application
With objAccess
lngRet = apiSetForegroundWindow(.hWndAccessApp)
lngRet = apiShowWindow(.hWndAccessApp, SW_NORMAL)
'the first call to ShowWindow doesn't seem to do anything
lngRet = apiShowWindow(.hWndAccessApp, SW_NORMAL)
.OpenCurrentDatabase strMDB
Set db = objAccess.CurrentDb
Set rs = db.OpenRecordset(strTable, dbOpenDynaset)
rs.AddNew
'this section: the first field in the table is index 0 or you can use the names...
' rs.fields(0), rs.Fields(1) or rs.Fields("Name"

, rs.Fields("Street"

' add as many a you need prior to the rs.Update
rs.Fields(0) = "Bird"
rs.Update
End With
End If
testme = True
ErrorExit:
objAccess.Quit
Set objAccess = Nothing
Set rs = Nothing
Set db = Nothing
Exit Function
ErrorHandler:
testme = False
Resume ErrorExit
End Function
'************* End Code *************** It's not important that someone else can do in one step what it took you ten to do...the important thing is that you found a solution.
Robert L. Johnson III, A+, Network+, MCP
Access Developer/Programmer