Solved

Exporting form data to Access

Posted on 2001-06-17
2
156 Views
Last Modified: 2010-04-08
I have created an outlook form that contains a number of text boxes and a command button. On clicking the command button, I would like to export the text values directly into an Access table.

Can any one tell me what coding I need to use in the Command Button.

Any help on this will be much appreciated.

Thanks in anticipation.
0
Comment
Question by:markbriggs
2 Comments
 
LVL 9

Accepted Solution

by:
rjcpjc earned 100 total points
ID: 6200619
Here's a link and some sample code:

http://www.slipstick.com/dev/database.htm

-----

Sub cmdButtonName_Click()

'Set variables for database connection

Set dbe = CreateObject("ADODB.Connection")
Set rst = CreateObject("ADODB.Recordset")

blnFound = False

dbe.Mode = 3
dbe.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\Windows\Desktop\dbname.mdb;"
strSQL = "SELECT * FROM AddressInformation;"
rst.Open strSQL,dbe,2,3
rst.MoveFirst

rst.AddNew

rst.Fields("FieldName") = Item.UserProperties.Find("fieldname").value
'continue for all fields you want to write to the database

rst.Update

rst.Close
dbe.Close

Set rst = Nothing
Set dbe = Nothing

End Sub

--------

Hope this helps.  If you need more assistance, post back.

--PatriciaC
0
 

Author Comment

by:markbriggs
ID: 6204029
Spot on.  Thanks.
0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Use email signature images to promote corporate certifications and industry awards.
If you don't know how to downgrade, my instructions below should be helpful.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now