Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Exporting data from Custom outlook form to Access Database

Status
Not open for further replies.

tatty

Technical User
Mar 31, 2000
9
GB
Could anyone please help me?

I have a Custom outlook form which holds information that I would like to transfer into a Access database.

I would like the form to have a buttom that the user clicks which would then in turn dump the info from that form into a table in the database (basically append to the table). I have searched everywhere for code to do this but it seems that everyones just wants to import from an Access database into the Outlook forms!!

Can someone please advise whether this is possible or not?

Thanks
 
Unfortunately I haven't worked with Access yet, but I have integrated Excel with my custom Outlook forms. I took the following bit from one of my forms and modified it to (hopefully) open an Access database:

Code:
Function cmdSubmit_Click()
Set fso = CreateObject("Scripting.FileSystemObject")
FileLoc = "//database.mdb"

If fso.FileExists(FileLoc) Then
    On Error Resume Next
    Set oAccess = GetObject(, "DAO.DBEngine")
    If Err.Number <> 0 Then
        Err.Clear
        Set oAccess = CreateObject(&quot;DAO.DBEngine&quot;)
    End If
Else
    strErr = FileLoc & &quot; could not be found.&quot;
    MsgBox (strErr), vbCritical, &quot;Error: File Not Found&quot;
    Exit Function
End If

'useful stuff goes here
End Function

This will check to see if Access is already open and if not will open the program (opening the database if it exists). From here you'll need to dig through the Access object model to figure out how to access and append the information you want.

Well, hope that helps a little... [peace]
 
Forgot to hit this point: If you've found code for importing data &quot;From&quot; Access, it shouldn't be too difficult to take that same code and reverse it to export data &quot;To&quot; Access.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top