Results 1 to 3 of 3
  1. #1
    5 Star Lounger
    Join Date
    Oct 2002
    Location
    Wellington, Wellington, New Zealand
    Posts
    621
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Clicking a control vbutton to save and move to the (Accesse 2002 SP3)

    I was wondering, now that my application does almost everything I want, how to ...

    I have a form that displays a user's record, and a sub-form of transactions. I have a control button that I wish to have
    a) set a field to a particular vaue
    [img]/forums/images/smilies/cool.gif[/img] save the record and move to the next

    I'd thought this should be easy - but clearly I'm missing something. My event procedures currently looks like this

    Private Sub Remove_Click()
    ' this is waiting to happen
    ReceiptAmount = 0
    Forms!ReviewExceptions.Refresh
    End Sub

    Any help would be greatly appreciated. I certainly know more about it this week than I did last week . At this rate of progress I'll hardly have to ask anything next week <img src=/S/grin.gif border=0 alt=grin width=15 height=15>

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 28 Times in 28 Posts

    Re: Clicking a control vbutton to save and move to the (Accesse 2002 SP3)

    Is the button Remove on the main form, and is ReceiptAmount is a field in the record source of the subform? If that is correct, the code could look like this:

    Private Sub Remove_Click()
    Me!NameOfTheSubform!ReceiptAmount = 0
    Me!NameOfTheSubForm.SetFocus
    RunCommand acCmdRecordsGoToNext
    End Sub

    Replace NameOfTheSubform with the name of the subform as a control on the main form. This is not necessarily the same as the name of the subform in the database window.

    Note: it is not necessary to save the record explicitly. Access will do this automatically when you move to another record.

  3. #3
    5 Star Lounger
    Join Date
    Oct 2002
    Location
    Wellington, Wellington, New Zealand
    Posts
    621
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Clicking a control vbutton to save and move to the (Accesse 2002 SP3)

    Hans Thanks ... once again ... that does it. <img src=/S/thankyou.gif border=0 alt=thankyou width=40 height=15>

    The bit I'd never found was the

    RunCommand acCmdRecordsGoToNext

    but now I know enough to be dangerous

Posting Permissions

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