- Local time
- Today, 10:40
- Joined
- Feb 19, 2002
- Messages
- 42,970
Setting DataEntry to true prevents the form from showing old records. That means you need a button on the main form to toggle the DataEntry property of the subform. This is probably the easiest way to achieve your objective of always going to an empty record.
Personally, I don't like manipulating subforms this way. When a user opens this form, how frequently is it to add a new record to the subvorm vs view/change the data in the main form or view/change the data in the subform. Seems to me that at least half the time you want to log out so that tips the balance to mostly you want to see existing records and less than half the time, you want to add a new record so I would NOT automatically go to a new record.
After reading your code more closely, it looks like you want to manipulate which controls are enabled. The easiest way to do this is with the Me.NewRecord property. Everything can be enabled for new records. The reason for not disabling the logout is because if someone logs in and out at the same time, locking the logout just makes that annoying because you have to save the record, leave it, and then go back. For existing records, the Login can be disabled and if the logout is already populated, you can set the AllowUpdates property to No rather than locking individual fields.
Personally, I don't like manipulating subforms this way. When a user opens this form, how frequently is it to add a new record to the subvorm vs view/change the data in the main form or view/change the data in the subform. Seems to me that at least half the time you want to log out so that tips the balance to mostly you want to see existing records and less than half the time, you want to add a new record so I would NOT automatically go to a new record.
After reading your code more closely, it looks like you want to manipulate which controls are enabled. The easiest way to do this is with the Me.NewRecord property. Everything can be enabled for new records. The reason for not disabling the logout is because if someone logs in and out at the same time, locking the logout just makes that annoying because you have to save the record, leave it, and then go back. For existing records, the Login can be disabled and if the logout is already populated, you can set the AllowUpdates property to No rather than locking individual fields.
Last edited: