Results 1 to 2 of 2
  1. #1
    Join Date
    Apr 2004

    Unanswered: GoToRecord - Runtime error 2105

    In a tabluar form I want some code to automatically pupulate the value of the ProjID field when a new record is created. I've written some code to do this by going to the first record, copying the value from ProjID (if not null) and pasting into the ProjID field of the last record.

    If I'm already at the first line, everything works as planned. If I'm at any other field, I get runtime 2105 when the "docmd....acFirst" line is encountered. What's going on? How do I fix this? BTW...I'm a VBA newbie so be gentle.

    Private Sub Task_AfterUpdate()
    Dim RID As Double

    DoCmd.GoToRecord , , acFirst

    If IsNull([ProjID]) Then
    MsgBox ("Sorry fatty, didn't work")
    RID = [ProjID]
    'MsgBox (RID)
    DoCmd.GoToRecord , , acLast
    [ProjID] = RID
    End If
    End Sub

    This is in Access 2002, but the database was previously converted from 97.

  2. #2
    Join Date
    Oct 2003
    Provided Answers: 1
    Why don't you use a RecordSet and go through it searching your ProjID?

Posting Permissions

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