Results 1 to 6 of 6
  1. #1
    Lounger
    Join Date
    Jan 2005
    Location
    Jacksonville, North Carolina, USA
    Posts
    29
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Next Record not New Record (2003/SP1)

    Hello All,
    This is my first post, so here it goes. I'm working on my first DB form. My newest pet peeve in life is how the "next record" button will go to a new record once it's reached the last record in the db. Is there any way to get this button to act as a navigation button only and not create a new record?

    My code Sir (or Ma'am):
    Private Sub HelpdeskBack_Click()
    On Error GoTo Err_HelpdeskBack_Click

    DoCmd.GoToRecord , , acPrevious

    Exit_HelpdeskBack_Click:
    Exit Sub

    Err_HelpdeskBack_Click:
    MsgBox "Beginning of database", vbOKOnly, "First Record"
    Resume Exit_HelpdeskBack_Click

    End Sub

    I've attached a picture of the form for good measure.

    Thank you for you time,

  2. #2
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Next Record not New Record (2003/SP1)

    You can set the form's AllowAdd property to false, which will prevent the navigation buttons from taking you to a new record. However, it will also prevent you from intentionally adding a new record. Is that what you want?
    Charlotte

  3. #3
    Lounger
    Join Date
    Jan 2005
    Location
    Jacksonville, North Carolina, USA
    Posts
    29
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Next Record not New Record (2003/SP1)

    Thank you Charlotte but I don't know where to find the AllowAdd property, so I can't tell you if it's what I'm looking for or not [img]/forums/images/smilies/wink.gif[/img]
    I want to be able to add new records, but only by clicking on the "New Record" button (shown as the "New" button in the included picture). Any further assistance would be greatly appreciated. [img]/forums/images/smilies/smile.gif[/img]

    Thanks again,

  4. #4
    Super Moderator
    Join Date
    Aug 2001
    Location
    Evergreen, CO, USA
    Posts
    6,613
    Thanks
    3
    Thanked 58 Times in 58 Posts

    Re: Next Record not New Record (2003/SP1)

    If you look at the properties of the form (use the pointing finger on your toolbar), one of those is AllowAdd. Set it to No and you should be set to go. However you will need to manipulate that same property in code if you want to use the same form to add a record.
    Wendell

  5. #5
    Lounger
    Join Date
    Jan 2005
    Location
    Jacksonville, North Carolina, USA
    Posts
    29
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Next Record not New Record (2003/SP1)

    Thank you WendellB. I disabled the AllowAdd and the next record button works exactly how I'd like it to ... however I can no longer add any new records using the new record button. You mentioned manipulating the AllowAdd property code, but I'm unable to locate this (and even if I did I'd have a snowball's chance of knowing what to do) [img]/forums/images/smilies/wink.gif[/img] Do you have any suggestions?

    Thank you,

  6. #6
    Lounger
    Join Date
    Jan 2005
    Location
    Jacksonville, North Carolina, USA
    Posts
    29
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Next Record not New Record (2003/SP1)

    Oops! Sorry ... I figured it out. Thank you both for your help. If you're ever in Jacksonville NC, I'll buy you a beer [img]/forums/images/smilies/smile.gif[/img]

    Thanks again,
    MULK

    P.S. - Here's the code
    Private Sub HelpdeskNext_Click()
    On Error GoTo Err_HelpdeskNext_Click


    DoCmd.GoToRecord , , acNext
    AllowAdditions = False

    Exit_HelpdeskNext_Click:
    Exit Sub

    Err_HelpdeskNext_Click:
    MsgBox "End of database", vbOKOnly, "Last Record"
    Resume Exit_HelpdeskNext_Click

    End Sub
    Private Sub HelpdeskNew_Click()
    On Error GoTo Err_HelpdeskNew_Click
    AllowAdditions = True

    DoCmd.GoToRecord , , acNewRec

    Exit_HelpdeskNew_Click:
    Exit Sub

    Err_HelpdeskNew_Click:
    MsgBox Err.Description
    Resume Exit_HelpdeskNew_Click

    End Sub

Posting Permissions

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