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.