Papa_Bear1
Member
- Local time
- Yesterday, 19:57
- Joined
- Feb 28, 2020
- Messages
- 86
I'm very frustrated that the many years of experience with Access VBA, still leaves me challenged to do the simplest things.
I have a simple form, connected to a simple table, and I want to perform a simple process - just add a new record.
I'm trying to avoid the scenario where the user keeps adding empty new records.
I have a "New" button to create a new record, I want the focus of the form on the new record, I want the focus to be on a particular control, and I already have it set up to fill a name field/control with a default value (like "<Enter new value>" kind of thing). I want the focus to STAY on that control if the user does not change that value.
Trying to create a new record alone has been ridiculously difficult. I've found that I cannot use GotoRecord ,, acNewRec. It simply does not work - but anyway - I digress. I finally have the new record created and focus on that record.
But, at this point - I CANNOT find a way to keep the focus on that one control (if user leaves default value alone).
> I've tried On Lost Focus - followed by Me.Undo. No go.
> I've tried On Lost Focus - followed by DoCmd.CancelEvent, but Nope - doesn't work.
> I've tried AfterUpdate, but that of course can't work - because it won't catch when they didn't update it - which is what I care about.
> I thought maybe I could trick it by having it all done at the table/data layer - with a field validation 'against' the default value. Of course - that can't work - it won't even allow the value to exist in the first place.
Would very much appreciate some ideas.
I have a simple form, connected to a simple table, and I want to perform a simple process - just add a new record.
I'm trying to avoid the scenario where the user keeps adding empty new records.
I have a "New" button to create a new record, I want the focus of the form on the new record, I want the focus to be on a particular control, and I already have it set up to fill a name field/control with a default value (like "<Enter new value>" kind of thing). I want the focus to STAY on that control if the user does not change that value.
Trying to create a new record alone has been ridiculously difficult. I've found that I cannot use GotoRecord ,, acNewRec. It simply does not work - but anyway - I digress. I finally have the new record created and focus on that record.
But, at this point - I CANNOT find a way to keep the focus on that one control (if user leaves default value alone).
> I've tried On Lost Focus - followed by Me.Undo. No go.
> I've tried On Lost Focus - followed by DoCmd.CancelEvent, but Nope - doesn't work.
> I've tried AfterUpdate, but that of course can't work - because it won't catch when they didn't update it - which is what I care about.
> I thought maybe I could trick it by having it all done at the table/data layer - with a field validation 'against' the default value. Of course - that can't work - it won't even allow the value to exist in the first place.
Would very much appreciate some ideas.