TryingMyBest
Registered User.
- Local time
- Today, 18:42
- Joined
- Nov 18, 2004
- Messages
- 54
What's wrong with this code please. I have an appointment in outlook and I want to use the following code to update the access tables with the custom fields in outlook. The variables are showing the correct data as is in the outlook form, however it is picking up only the first record in the table so the while statement is returned as false. What is the correct code to cycle through the records until the match is made?
Thanks
Jo
Code:
Public Sub APTInterface()
Set ins = Application.ActiveInspector
Set itm = ins.CurrentItem
Set con = itm
Set appAccess = CreateObject("Access.Application")
strAccessPath = "U:\APT\Release 3\"
Set dbe = CreateObject("DAO.DBEngine.36")
strDBName = "audit_planning_Tool.mdb"
strDBNameAndPath = strAccessPath & strDBName
Set wks = dbe.Workspaces(0)
Set dbs = wks.OpenDatabase(strDBNameAndPath)
Set rst = dbs.OpenRecordset("tblauditdata")
rst.Edit
While con.UserProperties("AuditNumber") = rst!AuditNumber
con.UserProperties("AuditDate") = rst!AuditDate
Wend
rst.Update
rst.Close
dbs.Close
Set itm = Nothing
Set wks = Nothing
Set dbe = Nothing
Set appAccess = Nothing
End Sub
Thanks
Jo