Make default value "real"

  • Thread starter Thread starter Allison
  • Start date Start date
A

Allison

Access 2003 SP3
Win XP SP2

I have a sub-form with a single combo box. The combo box is tied to a
table, and the subform is tied to a table that combines the main from ID and
the value of the combo box and creates an entry. (Relational yes/nos from
Allen Browne: http://allenbrowne.com/casu-23.html ).

I've set the default value of the combo box to "1", which displays my first
entry option (let's cal that "blue"). This displays the word "blue" but
doesn't actually capture it to the combination table in the same manner that
it would if "blue" were SELECTED, not just displayed.

Is there a way to SELECT a value by default - not just display it?
 
Allison, I'm not 100% clear about what you want to do here.

Are you saying that every time the user enters a new record in the main
form, you want to automatically insert the 'blue' record into the subform's
table as well? If so, you could do that by executing an append query
statement in the AfterInsert event procedure of the main form.

I'm not convinced that's a good idea. Does 'blue' really apply to everyone?
There are cases where this is valid, but not as a general rule.

If that's not what you want to do, then it might be best to leave the
combo's Default Value blank, so it's obvious to the user that they must
select 'blue' if they want it.
 
Access 2003 SP3
Win XP SP2

I have a sub-form with a single combo box. The combo box is tied to a
table, and the subform is tied to a table that combines the main from ID and
the value of the combo box and creates an entry. (Relational yes/nos from
Allen Browne: http://allenbrowne.com/casu-23.html ).

I've set the default value of the combo box to "1", which displays my first
entry option (let's cal that "blue"). This displays the word "blue" but
doesn't actually capture it to the combination table in the same manner that
it would if "blue" were SELECTED, not just displayed.

Is there a way to SELECT a value by default - not just display it?

I agree with Allen that this seems a bit strange. A child table with only one
field, containing "Blue" in every record, seems singularly useless to me!

A Default Value applies only when a new record is created; you will need to
"dirty" the subform in some way.
 
Yes that's what I want to do.

Reason is - there will be separate user forms for each "default" type - so
there shouldn't be a need for the user to have to enter the type because the
fact that they're using a specific form means that it is so.

I'll look at the append function. Thanks.
 
Okay: so there are default types to be assigned when a main record is
created. That makes sense. Executing the append query in the main form's
Form_AfterInsert is what I use for that.

If Execute is new, you can mock up an Append query, and switch it to SQL
View to see a sample of the string you need to create. Then this link
explains and provides an Execute example:
http://allenbrowne.com/ser-60.html
 
Back
Top