Results 1 to 6 of 6
  1. #1
    kirmankatz is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Aug 2012
    Posts
    3

    Runtime error 2105 You cannot go to the specified record

    Firstly, apologies as I am sure this will have been posted many times before but,

    I have taken over a voluntary task of entering paintings into a database for an local art club's exhibition.

    All paintined entered andthe selected ones for hanging numbered.

    Last job is to produce an index of artists.

    The query runs but then ends with the 2105 run time error above.

    The visual basic highlights a line of code but I have absolutely NO experience of visual basic so I'm stumped.

    The Index that has been produced up to the error gives the wrong paintings against some of the artists.

    I would be greatful for ANY help at all but please remember I am NOT a programmer myself.
    below is the code showing the highlighted line.

    Any help very great fully received.



    Thanks

    Lisa

    Private Sub Command9_Click()

    DoCmd.OpenQuery "DeleteCatalogueT"

    Let NoOfPaintings = DCount("[Medium]", "[Paintings Table]")
    Let A = 0

    DoCmd.OpenForm "CatalogueTF", acFormDS
    DoCmd.GoToRecord , , acNewRec

    DoCmd.OpenForm "CatalogueIndexQF", acFormDS
    DoCmd.GoToRecord , , acFirst

    For x = 1 To 1000

    Let NoOfPersonPainting = DCount("[Medium]", "[Paintings Table]", "[Artist ID No] = Forms!CatalogueIndexQF![Artist ID No]")

    Let Forms!CatalogueTF!Surname = Forms!CatalogueIndexQF!Surname
    Let Forms!CatalogueTF!Initials = Forms!CatalogueIndexQF!Initials
    Let Forms!CatalogueTF!Painting1 = Forms!CatalogueIndexQF![CatalogueNo]
    Let A = A + 1
    If NoOfPersonPainting = 1 Then GoTo ln2

    DoCmd.GoToRecord , , acNext
    Let Forms!CatalogueTF!Painting2 = Forms!CatalogueIndexQF![CatalogueNo]
    Let A = A + 1
    If NoOfPersonPainting = 2 Then GoTo ln2

    DoCmd.GoToRecord , , acNext
    Let Forms!CatalogueTF!Painting3 = Forms!CatalogueIndexQF![CatalogueNo]
    Let A = A + 1
    If NoOfPersonPainting = 3 Then GoTo ln2

    DoCmd.GoToRecord , , acNext
    Let Forms!CatalogueTF!Painting4 = Forms!CatalogueIndexQF![CatalogueNo]
    Let A = A + 1

    ln2:
    If A = NoOfPaintings Then GoTo ln3

    DoCmd.OpenForm "CatalogueTF", acFormDS
    DoCmd.GoToRecord , , acNewRec

    DoCmd.OpenForm "CatalogueIndexQF", acFormDS
    DoCmd.GoToRecord , , acNext

    Next x

    ln3:

    DoCmd.Close acForm, "CatalogueIndexQF"
    DoCmd.Close acForm, "CatalogueTF"

    DoCmd.OpenReport "CatalogueIndex", acViewPreview

    End Sub

  2. #2
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,726
    The error indicates you are trying to go to a record that doesn't exist.

    Do you have any idea what the code you have posted is suppose to do?
    Do you have working knowledge of the "business processes" supported by this data base?

    Do you have any documentation of this database and how to use it?

    When you attempt to move to Next record, there is always a possibility that there is no next record.
    You could catch the error and do some thing else.

    The coding technique is in need of review and some standards, in my view. Your use of Let seems out of context.

    Good luck with your project.

  3. #3
    kirmankatz is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Aug 2012
    Posts
    3
    Thank you for your reply Orange,

    I think that is exactly what the problem is - it's going through all the entries and then when it gets to the last one in the list it fails with the error as there isn't a 'next' record.

    How do I adjust the code so it recognises when there's no more it should end?

    There is no documentation I'm afraid.

    The business process is;
    artist submit paintings - they ALL get entered into the database.
    Some get selected for the exhibition and subsequently are given numbers for the catalog.
    The Catalog is produced in the order of the numbers.
    The Index is produced showing Artists in alphabetical order with the painting numbers of the pieces of work they have produced next to their names.

    i.e
    Bloggs J , 23, 59, 341
    Other AN, 2, 87, 251

    etc etc
    regards

    Lisa

  4. #4
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,726

  5. #5
    Missinglinq's Avatar
    Missinglinq is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Location
    Richmond (Virginia, not North Yorkshire!)
    Posts
    3,018
    I've no idea of what you're trying to do, here, but I use this in a custom navigation button to check whether or not you're on the Last Record before attempting to go to the Next Record:
    Code:
    If Me.CurrentRecord <> Me.RecordsetClone.RecordCount And Me.NewRecord <> True Then
      DoCmd.GoToRecord , , acNext
    Else
      'Do whatever you need to if no more Records
    End If


    Linq ;0)>
    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

  6. #6
    kirmankatz is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Aug 2012
    Posts
    3
    Thanks for everyone's replies.

    This issue seemed to solve itself once I went back through all the records and ensured they were all entered correctly (some had catagories set that weren't in the list)

    Thanks again.

    Please mark this thread as solved.

    Lisa


    Quote Originally Posted by Missinglinq View Post
    I've no idea of what you're trying to do, here, but I use this in a custom navigation button to check whether or not you're on the Last Record before attempting to go to the Next Record:
    Code:
    If Me.CurrentRecord <> Me.RecordsetClone.RecordCount And Me.NewRecord <> True Then
      DoCmd.GoToRecord , , acNext
    Else
      'Do whatever you need to if no more Records
    End If


    Linq ;0)>

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

Similar Threads

  1. Replies: 13
    Last Post: 06-12-2012, 09:52 PM
  2. Replies: 1
    Last Post: 06-04-2012, 03:37 PM
  3. Runtime Error 3027
    By jsbotts in forum Queries
    Replies: 4
    Last Post: 08-27-2011, 06:42 PM
  4. Error in Runtime Only
    By drunkinmunki in forum Programming
    Replies: 7
    Last Post: 12-16-2010, 03:43 PM
  5. Help With Runtime Error 4248
    By KLahvic in forum Programming
    Replies: 1
    Last Post: 04-09-2010, 07:47 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