Results 1 to 4 of 4
  1. #1
    Kaloyanides is offline Advanced Beginner
    Windows 7 64bit Access 2013
    Join Date
    Jan 2015
    Location
    Arlington, MA
    Posts
    51

    Angry .edit NOT Working.. Any idea why?

    The following works on every computer except one. I re-did all of the references...? Any idea why?

    Compile Error Fires here: rs.Edit

    Dim rs As Recordset
    Dim N As String
    Dim D As Date
    Dim S As Long
    Dim M As Long

    Set rs = CurrentDb.OpenRecordset("tblInvoiceLayout", dbOpenDynaset, dbDenyRead + dbDenyWrite, dbPessimistic)
    N = Nz(rs![InvoiceNumberPrefix], "") & rs![NextInvoiceNumber] & Nz(rs![InvoiceNumberSuffix], "")
    Me![InvoiceHeaderNumeric] = rs![NextInvoiceNumber]
    rs.Edit
    rs![NextInvoiceNumber] = rs![NextInvoiceNumber] + 1
    rs.Update
    Me![InvoiceHeaderNum] = N

    DoCmd.RunCommand acCmdSaveRecord

    Set rs = CurrentDb.OpenRecordset("tblPayments", dbOpenDynaset)
    rs.AddNew
    rs![PaymentInvoiceHeader] = Me![InvoiceHeaderNum]
    rs![PaymentAmount] = Me![InvoiceHeaderTotalAmount]

    S = TERMS.Column(2)


    If IsNumeric(S) Then
    rs![PaymentDueDate] = DateAdd("d", CDbl(S), Nz(Me![InvoiceHeaderDate], DATE))
    ElseIf S = "CASH" Then
    rs![PaymentDueDate] = Nz(Me![InvoiceHeaderDate], DATE)
    rs![PaymentPaidDate] = Nz(Me![InvoiceHeaderDate], DATE)
    ElseIf Left(S, 3) = "EOM" And IsNumeric(Mid(S, 4)) Then
    D = DateAdd("m", CDbl(Mid(S, 4)) + 1, Nz(Me![InvoiceHeaderDate], DATE))
    D = CDate("01/" & Format(D, "mm/yyyy")) - 1
    rs![PaymentDueDate] = D
    Else


    rs![PaymentDueDate] = DATE
    End If
    rs.Update

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,902
    Please post code between CODE tags to retain indentation and readability.

    What happens - error message, wrong result, nothing?
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    Kaloyanides is offline Advanced Beginner
    Windows 7 64bit Access 2013
    Join Date
    Jan 2015
    Location
    Arlington, MA
    Posts
    51
    After working on this for many hours, I figured it out 2min after posting to this forum. The issue had to do with the order of the references. I prioritized them and it appears to be working. Thx for attempting to help. Appreciate it.

  4. #4
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,793
    That's likely because your recordset isn't defined as DAO or ADO so Access will pick the first library reference that applies. I'm suggesting ADO was listed first. Better to use
    Dim rs As DAO.Recordset if that's the type you're creating.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Field Edit to Avoid No Entry is Not Working
    By ebrommhead in forum Programming
    Replies: 4
    Last Post: 01-08-2019, 10:49 AM
  2. Working on test. Anyone have an idea?
    By cloudpico in forum Access
    Replies: 1
    Last Post: 07-21-2014, 06:22 PM
  3. Replies: 1
    Last Post: 08-03-2012, 12:32 PM
  4. Replies: 3
    Last Post: 12-15-2011, 09:26 PM
  5. Edit button not working
    By elamaranr in forum Access
    Replies: 0
    Last Post: 07-25-2011, 01:45 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums