Default Value Help

dostrowsky

New Member
Joined
May 12, 2006
Messages
9
Hello All,

I have a subform that has all of its fields defaulted. The problem that I have is that when the data on the main form is entered the info from the subform isn't written into the tables. The only way to get it to write to the tables is to enter into the subform and change one value. This kind of defeats the purpose of having defaults. Is there any way I can get the defaults written into the table?
 

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.
Why not set the defaults in the table as well?
 
Upvote 0
I have...the problem is that because it is a subform a record in the subform table is not being created. So what is happening is the main table will have say 5 records and the subform table won't have any.
 
Upvote 0
Setting the defaults at the table level is a solution, but it doesn't help resolve his underlying question... why is this not working..

I believe you have something wrong ... most likely with how you linked (created) your main/sub forms.
 
Upvote 0
The only way I know of to write a record to the database is to actually change something in that record. Just because it shows up in a sub-form with all the fields defaulted, does not mean anything has been changed. I would suggest that within your main form, if you ALWAYS want the defaulted record in the subform written to the database, then within the OnCurrent event, read the default value for one of the fields, then write that value into that field, which will trigger the change in that record, and it will be written to the database. But remember, this will happen EVERY TIME a record in the main form is accessed. So, if the user just happens to scroll up and down the list of records in the main form, each record touched in this main form WILL create a record from the sub-form into the database.
I really can't imagine that is what you really want, so maybe a little more needs to be discussed.
HTH,
Vic
 
Upvote 0

Forum statistics

Threads
1,214,980
Messages
6,122,563
Members
449,088
Latest member
Motoracer88

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top