
How do I edit/update an existing record?
I am trying to update a record after its been posted in Access. In
step 1 a User will enter their data and send the Form/Message to me. I
open the message an run a job according to the Spec's. When they send
the message/form thier information is enter into an Access table.
After I run the job. I want to go back and edit their record and enter
the date/time I finished the job. below is the code I am using for
them to enter the data into access. Can anyone show me how to
edit/update the same record number?
Function Item_Send()
Dim Obe
Dim MyDB
Dim Rst
Dim Rsm
'On error resume next
Set Dbe = Application.CreateObject("DAO.DBEngine.35")
If Err.Number <> 0 Then
Msgbox Err.Description & "--- Some functions may not
work correctly" _
& Chr(13) & "Please make sure that DAO 3.5 is installed
on this machine"
Exit function
End If
Set MyDB = Dbe.Workspaces(0).OpenDatabase("G:
\TABS\PERM\CIGARSII\control room.mdb")
Set Rst = MyDB.OpenRecordset("db - Modem Files")
Rst.AddNew
' Access side Outlook side
'msgbox "jobnum;" & UserProperties.find("Jobnum").Value
Rst("Tasknum")= UserProperties.find("Jobnum").Value
Rst("receive")= UserProperties.find("recfile").Value
Rst("send")= UserProperties.find("sendfile").Value
Rst("cname")= UserProperties.find("coname").Value
Rst("rby")= UserProperties.find("reqby").Value
Rst("mdate")= UserProperties.find("datereq").Value
Rst("mphone")= UserProperties.find("modem").Value
Rst("password")= UserProperties.find("password").Value
Rst("customer")= UserProperties.find("customer").Value
Rst("client")= UserProperties.find("client").Value
Rst("Project")= UserProperties.find("Project").Value
Rst("fname")= UserProperties.find("filename").Value
Rst("reqby")= UserProperties.find ("reqbyclient").value
Rst.Update
Rst.Movelast
Rst.Close
MyDB.Close
End Function
Function Item_Open()
Dim Obe
Dim MyDB
Dim Rst
Dim Rsm
Dim Counter, CounterStart
Dim RequestNum
Dim RqBox
'On error resume next
Set Dbe = Application.CreateObject("DAO.DBEngine.35")
If Err.Number <> 0 Then
Msg Err.Description & "--- Some functions may not work correctly"
_
& Chr(13) & "Please make sure that Dao 3.5 is installed on this
machine"
Exit function
End If
Set MyDB = Dbe.Workspaces(0).OpenDatabase("G:
\TABS\PERM\CIGARSII\control room.mdb")
Set Rst = MyDB.OpenRecordset("db - TASK")
If UserProperties.find ("jobnum").value = 0 Then
CounterStart = 1
Counter= rst.recordcount + CounterStart
UserProperties.find ("jobnum").value = counter
Rst.AddNew
Rst("Tasknum")= counter
Rst.Update
Rst.Close
MyDB.CLose
End If
End Function
TIA
Sent via Deja.com http://www.*-*-*.com/
Before you buy.