Results 1 to 9 of 9
  1. #1
    Kipster1203 is offline Advanced Beginner
    Windows XP Access 2000
    Join Date
    May 2010
    Posts
    54

    GoToRecord Help!!!!!!

    I have an afterupdate code set on a vlue in my form, this afterupdate goes to the following code:


    Code:
    Private Sub Request_Date_AfterUpdate()
    
        Dim Request_Add As Integer
    
        Request_Add = Me!Request_Number
        
        Request_Add = Request_Add + 1
        
        Me!Request_Number = Request_Add
        
        DoCmd.Requery
        
        DoCmd.GoToRecord ,,
         
        
        
    End Sub
    I have to requery in order for the data to be updated, the problem is that the cursor jumps to the first record in the table, and I need it to stay on the record being updated, can anyone fill in the blanks for me?? Thanks

  2. #2
    Kipster1203 is offline Advanced Beginner
    Windows XP Access 2000
    Join Date
    May 2010
    Posts
    54
    Why doesn't it automatically refresh on the record you are on after the Requery command? instead it goes to the first record.... any way around that?

  3. #3
    Join Date
    May 2010
    Posts
    339
    Code:
    Private Sub Request_Date_AfterUpdate()
    Me.Requery 
    End Sub
    Unless I am not understanding your post.


    Regards,

    Richard

  4. #4
    Kipster1203 is offline Advanced Beginner
    Windows XP Access 2000
    Join Date
    May 2010
    Posts
    54
    That didn't work, it requeries and jumps back to the first record. I need to stay on the current record.

  5. #5
    evander is offline Competent Performer
    Windows 7 Access 2003
    Join Date
    Apr 2010
    Location
    Philippines
    Posts
    206
    Let's say you have a form called frmKipster, and you have a button in that form...

    Private Sub Command10_Click()

    Dim lngCurrentRecord As Long
    lngCurrentRecord = Me.CurrentRecord

    Quantity = Quantity + 5
    Me.Requery

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

    End Sub

    Hope this helps.

  6. #6
    evander is offline Competent Performer
    Windows 7 Access 2003
    Join Date
    Apr 2010
    Location
    Philippines
    Posts
    206
    Could you please tell me how you created that grey box in which you put your VBA code? Sorry I couldn't make my own code readable. Kekekeke.

  7. #7
    Kipster1203 is offline Advanced Beginner
    Windows XP Access 2000
    Join Date
    May 2010
    Posts
    54
    Quote Originally Posted by evander View Post
    Let's say you have a form called frmKipster, and you have a button in that form...

    Private Sub Command10_Click()

    Dim lngCurrentRecord As Long
    lngCurrentRecord = Me.CurrentRecord

    Quantity = Quantity + 5
    Me.Requery

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

    End Sub

    Hope this helps.
    Click on the pound button in the toolbar I'm confused as to what to out for acDataForm and Me.Name as well as why you even need it. Thanks

  8. #8
    Kipster1203 is offline Advanced Beginner
    Windows XP Access 2000
    Join Date
    May 2010
    Posts
    54
    I just took the first 2 objects out and it worked!!!! Thanks so much!

  9. #9
    evander is offline Competent Performer
    Windows 7 Access 2003
    Join Date
    Apr 2010
    Location
    Philippines
    Posts
    206
    You're welcome. And thanks for showing me how I can use the pound symbol.

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

Similar Threads

  1. Remove Filter and GoToRecord
    By ombadboy in forum Programming
    Replies: 0
    Last Post: 09-04-2009, 07:35 AM
  2. Replies: 0
    Last Post: 03-15-2009, 03:22 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