Page 4 of 4 FirstFirst 1234
Results 46 to 50 of 50
  1. #46
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,518
    The old method would work, the new method would still be broken.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  2. #47
    Brian62 is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Aug 2009
    Posts
    147
    So am I at a deadend? Everything else works but the VB scripts.

  3. #48
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,518
    I wouldn't say dead end, but as you can see:

    Click image for larger version. 

Name:	Seek.jpg 
Views:	5 
Size:	83.8 KB 
ID:	8294

    You need to switch methods. The method I'm trying to guide you towards will work, and will actually be more efficient, but it's obviously difficult trying to debug it without seeing it.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  4. #49
    Brian62 is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Aug 2009
    Posts
    147
    Here is the copy of the db as requested. Thanks!
    Attached Files Attached Files

  5. #50
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,518
    This is working up to the Update line, where I get an error about duplicates. Since I'm probably testing wrong, I'll let you play with it. I obviously didn't adjust the code in the Else yet. I've got to work on a project.

    Code:
      Dim DBS                     As dao.Database
      Dim RS                      As dao.Recordset
      Dim LngCnt                  As Long
      Dim strsql                  As String
      Dim lngNewID As Long
    
      strsql = "SELECT * FROM TblRDStudyAuditDocument WHERE ID_D = " & Me.ID_D
      Debug.Print strsql
    
      Set DBS = CurrentDb    'OpenDatabase("W:\RCO\Databases\RCO_Database_BE.accdb")
      Set RS = DBS.OpenRecordset(strsql, dbOpenDynaset, dbSeeChanges)
    
      With RS
    
        If Not .EOF Then
    '      .MoveFirst
    '      .Index = "PrimaryKey"
    '      .MoveLast
    '      lngNewID = .Fields(0) + 1
          .AddNew
          '.Fields(0) = lngNewID  'left out because it's an autonumber field
          !Studyid = Studyid
          !AuditDate = AuditDate
          !SectionName = TxtSectionName
          !DocName = DocName
          !Comments = Comments
          .Update
        Else
          .AddNew
          .Fields(0) = 1
          .Fields(1) = Studyid
          .Fields(2) = AuditDate
          .Fields(3) = TxtSectionName
          .Fields(4) = DocName
          .Fields(5) = Comments
          .Update
          ID_D = 1
    
        End If
        .Close
    
      End With
    
      Set DBS = Nothing
      Set RS = Nothing
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

Page 4 of 4 FirstFirst 1234
Please reply to this thread with any new information or opinions.

Similar Threads

  1. "not an index in this table" error
    By everette in forum Access
    Replies: 4
    Last Post: 04-06-2012, 05:03 AM
  2. Replies: 2
    Last Post: 11-04-2011, 02:45 AM
  3. Replies: 1
    Last Post: 04-25-2011, 12:36 PM
  4. "Group By" causes "ODBC--Call Failed" error
    By kaledev in forum Queries
    Replies: 1
    Last Post: 03-09-2011, 02:43 PM
  5. Replies: 4
    Last Post: 06-10-2010, 07:51 AM

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