How do I edit/update an existing record? 
Author Message
 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.



Sun, 03 Nov 2002 03:00:00 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. Updating a single OLE link for a record OR updating existing database

2. Editing an existing record in VB6

3. Scanning records and doing updates

4. Updating existing records

5. appendchunk can't update existing records

6. SQL Statement for updating an existing recording in a db

7. Help: Edit will only update first record stored

8. Problem in Editing the Record in Batch Update mode ADODB.RescordSet

9. Edit/Update record in keyset resultset

10. Problem in Editing the Record in Batch Update mode ADODB.RescordSet

11. Editing and Updating a Record

12. Edit/Update record in keyset resultset

 

 
Powered by phpBB® Forum Software