Results 1 to 3 of 3
  1. #1
    Join Date
    Apr 2005

    Unanswered: GoToRecord problem


    I am trying to go to a specific record in a table. The following if then statement will bring me to the record:

    If strGlobalMemberRecordOpened = "No" Then
    DoCmd.GoToRecord , , acFirst

    If [SSN] = strGlobalMemberSSN Then
    strGlobalMemberRecordOpened = "Yes"
    Exit Do
    DoCmd.GoToRecord , , acNext
    End If
    End If

    But this you see on the screen all the member records cycle through until it reaches the correct record.

    what I would like to do is to just go to the specific member such as in this example lngRecordNumber = 561. There are 600 records total.

    DoCmd.GoToRecord , , lngGlobalRecordNumber

    Where lngGlobalRecordNumber is the actual record number to go to.

    I've tried many different ways of formating this DoCmd but can't seem to get it right. This gives me the Run-Time error '2505
    An expression in argument 3 has an invalid value.

    Any Help would greatly be appreciated.

  2. #2
    Join Date
    Apr 2006
    try this

    DoCmd.GoToRecord acDataForm, Me.Name, acGoTo, lngGlobalRecordNumber

    and declare GlobalRecordNumber as Long
    Only quitters quit!

  3. #3
    Join Date
    Apr 2005

    Thank You

    That worked great. It no longer cycles through every record and it's faster because the first record that it pulls up is the record that I wanted.

    I've search many locations but none gave me what I wanted.

    Thanks for the great help at dBforums. This is truely the place you want to go to find what you need.


Posting Permissions

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