Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Outllok97 Form to Access 97 DB

1 view
Skip to first unread message

Pete T

unread,
Sep 2, 2003, 9:53:25 AM9/2/03
to
I hope this post helps thise who are looking for a solution to moving
data from an Outlook 97 Custom Form to a Database (Access 97). I
spent several weeks working on finding VBScript coding for this
simple, but poorly documented, project. Very few site I was directed
to had an answer to my needs:

I have an Outllok 97 Form (page 1- named Message). It has several
custom text and check boxes which staff throughtout the office send to
one staff member. That person moved that data by hand to a Database.
I added a Button to the form called CommandButton1, and added the
VBScript to move the data automatically when the button is clicked as
follows:

Sub CommandButton1_Click()

' VB Script for Claims Notification Forms
' 08/25/03 by P.Trudell

' Database objects
Dim rst
Dim dao
Dim wks
Dim db

' Form Objects
Dim SSN
Dim Remarks2

' Oject Controls
Dim objPage
Dim objControls

Set objPage = Item.GetInspector.ModifiedFormPages("Message")
Set objControls = objPage.Controls
Set SSN = objControls("SSN")
Set Remarks2 = objControls("Remarks2")

Set dao = Application.CreateObject("DAO.DBEngine.35")
Set wks = dao.Workspaces(0)
Set db = wks.OpenDatabase("\\Your DB.MDB")
Set rst = db.OpenRecordset("Your Table")
rst.AddNew
rst.SSN = SSN.Value
rst.Reason = "Your Value"
rst.User = "IP Address"
rst.Remarks = Remarks2.Value
rst.Update
MsgBox "Update Complete."
rst.Close
db.Close

End Sub

Since this data comes from the same staff member the rst.User is
hardcoded; also rst.Reason is standard also, but both of these could
be fillins as SSN and Remarks2 are. Just ensure that all objects are
DIM. Our database is located on a different PC so I directed the
OpenDatabase to \\ location. If it's located on your PC use C:\ etc.

Hope this helps soem folks who are still working with Office 97
Products.

0 new messages