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?
 

Some videos you may like

Excel Facts

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).

Norie

Well-known Member
Joined
Apr 28, 2004
Messages
76,235
Office Version
  1. 365
Platform
  1. Windows
Why not set the defaults in the table as well?
 

dostrowsky

New Member
Joined
May 12, 2006
Messages
9
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.
 

MyBoo

Board Regular
Joined
Aug 9, 2006
Messages
217
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.
 

VicRauch

Well-known Member
Joined
Mar 23, 2006
Messages
2,032
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
 

Watch MrExcel Video

Forum statistics

Threads
1,123,514
Messages
5,602,093
Members
414,501
Latest member
mdhaumyu

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
Top