Results 1 to 2 of 2
  1. #1
    3 Star Lounger
    Join Date
    Oct 2002
    Location
    Houston, Texas, USA
    Posts
    303
    Thanks
    0
    Thanked 0 Times in 0 Posts

    field not post in database (MS Outlook & VBA)

    I just took over this form from someone that was just laided off. I have just found out that it is not working correctly.
    For some reason when it gets to chaning the txtstatus (status update) field it does not update this one field, but the other fields are updated.

    -=-=-=-=-=-=-=-=-=-=-=-=-=-
    'Data Security to Network Section
    '-=-=-=-=-=-=-=-=-=-=-=-
    Sub cmdCBMan3_click()
    Update11
    update11a
    End Sub
    '-=-=-=-=-=-=-=-=-=-=-=-

    '-=-=-=-=-=-=-=-=-=-=-=-=-=-
    Sub Update11()
    Dim Obe
    Dim MyDB
    Dim Rst
    Dim Rsm
    Dim nms

    'On error resume next
    Set obe = Application.CreateObject("DAO.DBEngine.36")
    If Err.Number <> 0 Then
    MsgBox Err.Description & "--- Some functions may not work correctly" _
    & Chr(13) & "Please make sure that DAO 3.6 is installed on this machine"
    Exit Sub
    End If
    UserProperties.Find("netgot").Value = Now
    UserProperties.Find("txtstatus").Value = "Work in Progress"

    End Sub
    '-=-=-=-=-=-=-=-=-=

    '-=-=-=-=-=-=-=-=-=
    Sub Update11a()
    Dim Obe
    Dim MyDB
    Dim Rst
    Dim Rsm

    'On error resume next
    Set obe = Application.CreateObject("DAO.DBEngine.36")
    If Err.Number <> 0 Then
    MsgBox Err.Description & "--- Some functions may not work correctly" _
    & Chr(13) & "Please make sure that DAO 3.6 is installed on this machine"
    Exit sub
    End If

    Set MyDB = Dbe.Workspaces(0).OpenDatabase("testdatabase$copyb lank.mdb")
    RequestNum = UserProperties.Find("jobnum").Value
    Set Rst = MyDB.OpenRecordset("select * from dbtask where tasknum = " & RequestNum)

    If Rst.EOF = True And Rst.BOF = True Then
    MsgBox "Empty record or not found" 'error hand
    Else
    Rst.Edit
    Rst.fields("Operator1") = UserProperties.Find("saname1").Value
    Rst.fields("txtstatus") = UserProperties.Find("txtstatus").Value
    Rst.fields("netgot") = UserProperties.Find("netgot").Value
    Rst.Update
    End If
    Rst.Close
    MyDB.Close
    End Sub
    '-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: field not post in database (MS Outlook & VBA)

    Try setting a breakpoint at the beginning of cmdCBMan3_click(), then single-step through the code when it is called.
    Check whether the user property txtstatus is set correctly in Update11. If it is not set correctly there, it won't be set correctly in the database either. And check what happens when the record is edited in Update11a.

    Note: both Update11 and Update11a declare variables that are never used. The check for DAO in Update11 isn't necessary.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •