Why subform defaults to start new record?? (1 Viewer)

fedebrin

Registered User.
Local time
Yesterday, 19:49
Joined
Sep 20, 2017
Messages
59
Hello all,

I have a problem with a subform (Inside another form)

Automatically when loading it defaults to creating a new record causing me issues since it starts in a mandatory field... is there a way to stop this?

Take a look at the print-screen

thanks!
 

Attachments

  • Subform defaults to new record when loading.JPG
    Subform defaults to new record when loading.JPG
    98 KB · Views: 55

pbaldy

Wino Moderator
Staff member
Local time
Yesterday, 19:49
Joined
Aug 30, 2003
Messages
36,125
Are there existing records it should display? If so, what is the form's Data Entry property? What are the master/child links?
 

fedebrin

Registered User.
Local time
Yesterday, 19:49
Joined
Sep 20, 2017
Messages
59
Hi, thanks for the quick response, yes there are existing records to display.

The Date Entry proerty is set to "No"

The record source is another table called "ACTIONS"
See print-screen

Thanks again
 

Attachments

  • Subform defaults to new record when loading 2.jpg
    Subform defaults to new record when loading 2.jpg
    99.6 KB · Views: 49

pbaldy

Wino Moderator
Staff member
Local time
Yesterday, 19:49
Joined
Aug 30, 2003
Messages
36,125
There are records meeting that filter as well? Are there master/child links specified in the subform control?
 

fedebrin

Registered User.
Local time
Yesterday, 19:49
Joined
Sep 20, 2017
Messages
59
Hello, I deleted that filted as I don need it and it still does it.

Sorry, how do I check that regarding the master/child links?

thanks
 

pbaldy

Wino Moderator
Staff member
Local time
Yesterday, 19:49
Joined
Aug 30, 2003
Messages
36,125
They are properties of the subform control (the container that holds a subform).
 

Pat Hartman

Super Moderator
Staff member
Local time
Yesterday, 22:49
Joined
Feb 19, 2002
Messages
43,275
If the pencil shows up before you type anything, then your own code is dirtying the record.

When you have to automatically populate data in a subform, the best event to use is the subform's BeforeInsert event. That event fires only once and it happens when the user types the first character into any control. Therefore, it doesn't happen unless the user himself actually dirties the record.

Please post the entire code module of the subform if you can't figure out what code s dirtying the record. You may also have to look at code in the main from but we'll start with the subform.
 

fedebrin

Registered User.
Local time
Yesterday, 19:49
Joined
Sep 20, 2017
Messages
59
yes, I think you got it Pat.

It is an event I have that updates the date in the field based on a subform of the actions.

The BeforeInsert even does not work for me because I need this macro to update after I change something on the subform of actions. I am looking to see which one could help me.
 

Pat Hartman

Super Moderator
Staff member
Local time
Yesterday, 22:49
Joined
Feb 19, 2002
Messages
43,275
The best event to use for "stamping" a record with date/time and updated by is the FORM's BeforeUpdate event. This is the last event to run before the record gets saved. It will never be bypassed (short of someone pulling the plug) regardless of what causes a record to be saved. It runs for Adds and Changes.
 

Users who are viewing this thread

Top Bottom