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

    Home » Forums » AskWoody support » Productivity software by function » MS Access and database help » Clicking a control vbutton to save and move to the (Accesse 2002 SP3)

    Author
    Topic
    #413477

    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
    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 grin

    Viewing 1 reply thread
    Author
    Replies
    • #912601

      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.

      • #912743

        Hans Thanks … once again … that does it. thankyou

        The bit I’d never found was the

        RunCommand acCmdRecordsGoToNext

        but now I know enough to be dangerous

      • #912744

        Hans Thanks … once again … that does it. thankyou

        The bit I’d never found was the

        RunCommand acCmdRecordsGoToNext

        but now I know enough to be dangerous

    • #912602

      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.

    Viewing 1 reply thread
    Reply To: Clicking a control vbutton to save and move to the (Accesse 2002 SP3)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: