Default value of field not translating to table

jaitken0308

Registered User.
Local time
Today, 17:13
Joined
Jan 23, 2014
Messages
30
I've looked all over and can't find the answer...


My DB has one main table where all the records are stored, and one form with multiple tabs allowing for data entry and editing. There are two distinct "Data Types" I have in the tables, so on the two distinct form tabs, I created a text box with a default value for each one (if it's a Type A record, then the box has a default value of "Type A" and the same rules for Type B).


Here's the problem. It doesn't matter if I include the default value in the Form Properties Default Value field or if I do in VBA (using this method), when a new record is entered into the table, it makes them all default Type B records.

What gives?
 
Default value works on new records only, so the form with the default values has to be the same form in which you do the addition.
 
Default value works on new records only, so the form with the default values has to be the same form in which you do the addition.

Thanks for the quick reply.

That's the way it's setup. My main menu has several tabs, two of which are for adding a new "Type A" record and adding a new "Type B" record. The default value is associated with those tabs.

My main menu form also has four more tabs - one each for searching/editing the Type A and Type B records, a home splash type tab and a logout tab.

Since the form has tabs that allow for new data entry and existing data searching/editing, along with the home and logout, is this causing my problems? I guess what I'm asking is this: do I have to have a separate dedicated "Add" form and a separate dedicated "Search/Edit" form if I want the default value to work?

EDIT: Also, the text boxes that are programmed to contain the default value aren't visible to the user. Could this have anything to do with this?
 
Last edited:
You talk about tabs a lot. Tabs are just containers for other controls, and as such they have no impact on your data. Maybe by tabs you are in fact talking about subforms and if so, that makes a difference. If you add a record in a subform, the default values of the controls on the subform will be honoured. Subform record addition will not honour the default values of controls on other forms.
 
You talk about tabs a lot. Tabs are just containers for other controls, and as such they have no impact on your data. Maybe by tabs you are in fact talking about subforms and if so, that makes a difference. If you add a record in a subform, the default values of the controls on the subform will be honoured. Subform record addition will not honour the default values of controls on other forms.


No subforms. Just separate tabs with text/combo/check boxes for data entry/editing.
 
Fixed it!

The field that I was wanting to update with a default value on the two tabs was sending the info to the same field in the table (Item_Type). For some reason, it was only allowing one value instead of the two.

I created an OnDirty event for each tab to change the value to TypeA or TypeB, and now it works.

Thanks for all the help!
 

Users who are viewing this thread

Back
Top Bottom