none
Enter data into a form RRS feed

  • Question

  • I have a data entry form in Access 2010 where users key in check number, amount, loan number, GL & cost center ,etc. I have a button to add the new record (DoCmd.GoToRecord , , acNewRec). In some cases there could be up to 15 different GL’s and cost centers. The user has to key each record separately so I added  a check box on the form if there are multiple GL’s and if it is checked I have the data stay in the form so they don’t have to key it all in again. I can get the data to stay on the form but it doesn’t add a new record it just updates the data in the table. How can I make this work.

    Monday, August 7, 2017 5:31 PM

Answers

  • I sounds like, rather than carrying the values forward into a new record, the form is staying on the current record.

    You might like to take a look at Defaults.zip in my public databases folder at:

    https://onedrive.live.com/?cid=44CC60D7FEA42912&id=44CC60D7FEA42912!169

    Note that if you are using an earlier version of Access you might find that the colour of some form objects such as buttons shows incorrectly and you will need to  amend the form design accordingly.  

    If you have difficulty opening the link copy its text (NB, not the link location) and paste it into your browser's address bar.

    This little demo file illustrates how to electively carry forward values from a newly inserted record as the defaults for subsequent records, either in the current session of the form only, or for subsequent sessions also.  The demo also illustrates how to copy a record, along with all of its related records in a referencing table, to a new record, though I don't think that would apply in your case.

    Ken Sheridan, Stafford, England

    • Marked as answer by pdiddy9590 Wednesday, August 9, 2017 11:51 AM
    Monday, August 7, 2017 6:07 PM

All replies

  • Hi,

    Not sure how exactly you're making the form "stay" but perhaps the solution you're looking for is to set the Default Value instead.

    Just my 2 cents...

    Monday, August 7, 2017 5:35 PM
  • I sounds like, rather than carrying the values forward into a new record, the form is staying on the current record.

    You might like to take a look at Defaults.zip in my public databases folder at:

    https://onedrive.live.com/?cid=44CC60D7FEA42912&id=44CC60D7FEA42912!169

    Note that if you are using an earlier version of Access you might find that the colour of some form objects such as buttons shows incorrectly and you will need to  amend the form design accordingly.  

    If you have difficulty opening the link copy its text (NB, not the link location) and paste it into your browser's address bar.

    This little demo file illustrates how to electively carry forward values from a newly inserted record as the defaults for subsequent records, either in the current session of the form only, or for subsequent sessions also.  The demo also illustrates how to copy a record, along with all of its related records in a referencing table, to a new record, though I don't think that would apply in your case.

    Ken Sheridan, Stafford, England

    • Marked as answer by pdiddy9590 Wednesday, August 9, 2017 11:51 AM
    Monday, August 7, 2017 6:07 PM
  • Hi pdiddy9590,

    How did you get the data to stay on the form? It seem that you want to save the data that has been updated as a new record but it was always updated the data in the table, right? I agree with DBguy that you could use Default value to send the updated data to a new record and then save it.

    Here is the example.

    Private Sub Command32_Click()

    'save current updated data as new data

    Me.Request_Type.DefaultValue = Me.Request_Type.Value

    'go to new record, defaultvalue will help you create the new record as you update

    DoCmd.GoToRecord , , acNewRec

    'update any record so the record could be save

    Me.Request_Type.Value = Me.Request_Type.Value

    'go to the new record, last new record would be saved

    DoCmd.GoToRecord , , acNewRec

    End Sub

    Best Regards,

    Terry

    Wednesday, August 9, 2017 7:19 AM
  • Thanks for the help. I will try it.
    Wednesday, August 9, 2017 11:52 AM