985ranch
985ranch

Reputation: 43

Add new record to subform with VBA

A subform is populated by fields from a combo box, and the record saves as expected. With click on next record in the combo box, the record saved earlier is overwritten. I've tried the following on current in the main form and similar code but nothing works. It still wants to overwrite a previously saved record. Any suggestions?

Me![Forms![frmAccount]![subAccount].SetFocus
DoCmd.GoToRecord Record:=acNext, Offset:=1

The code in the following post did not work either? Making "DoCmd.GoToRecord" function work on a subform

Upvotes: 0

Views: 4122

Answers (1)

985ranch
985ranch

Reputation: 43

Use On Change on combo box field in main form and enter:

subFormname.SetFocus
DoCmd.GoToRecord , , acNewRec

I kept trying and came up with this syntax. Let me know if you have anything better.

Upvotes: 1

Related Questions