Default value

G

Guest

I am new in Access, and I have a problem with default value in form.
I would like to set default value of the text box based on the value from
field of the table which is not used in this form.
I have a table type_mail with field "type".
Then I have a table mail with field "type".
I have a form based on the the table mail.
I have set Default value of the text box to =[mail_type]![type] but when I
add new record I recieve #Name? in the text box.
Do you have some suggestions.
Thank you
 
G

Guest

Dear Dusan,

Assumming that the field "type" is related to the table type_mail (if you
have lets say in the table type_mail two fields: ID and meaning, e.g. 1 =
Normal mail, 2 = NonNormal Mail), then to get the default value = Normal
mail, it should be:

= 1

Hope this helps,

George

Ο χÏήστης "Dusan" έγγÏαψε:
 
G

Guest

Thanks Goerge, but this isn't my problem. I will try to explain it another
way.
I want to have a form based on the table type_mail with the field "type". In
this field I will write type of the mail e.g. "registered".
Then I want to have another form, based on the table mail with some fields
and one of the fields is "type". What I want to accomplish is, that when I
add new record, default value of the field [mail]![type] will be value from
the [type_mail]![type].
I wrote = [type_mail]![type] in the Default value of the text box type, but
I recieve just #Name? message.

Thank you
--
Dusan Rybar


George said:
Dear Dusan,

Assumming that the field "type" is related to the table type_mail (if you
have lets say in the table type_mail two fields: ID and meaning, e.g. 1 =
Normal mail, 2 = NonNormal Mail), then to get the default value = Normal
mail, it should be:

= 1

Hope this helps,

George

Ο χÏήστης "Dusan" έγγÏαψε:
I am new in Access, and I have a problem with default value in form.
I would like to set default value of the text box based on the value from
field of the table which is not used in this form.
I have a table type_mail with field "type".
Then I have a table mail with field "type".
I have a form based on the the table mail.
I have set Default value of the text box to =[mail_type]![type] but when I
add new record I recieve #Name? in the text box.
Do you have some suggestions.
Thank you
 
G

Guest

Hi Dusan,

"Type" is a reserved word in Access (one of hundreds) and shouldn't be used
as object names.


You can't refer to a field in a table like that. A table can have zero or
more records, which record is the "default" one?

If you want "registered" to be the default for the "type" field, one way is
to enter "registered" in the default property for the *control*.

It might be easier if you use a combo box based on the table "type_mail";
you can also set the default property for the combo box to "registered".

If you do it your way, the form that is based on the table "type_mail" must
be open.
Let's call it "frmType_Mail".

Then on the form based on the table "mail", you would set the default value
of the *control* bound to the field [mail]![type] using
[Forms]![frmType_Mail]![type].

(I used "type' to be consistant with your terms - I strongly suggest
renaming it)


HTH
--
Steve S
--------------------------------
"Veni, Vidi, Velcro"
(I came; I saw; I stuck around.)


Dusan said:
Thanks Goerge, but this isn't my problem. I will try to explain it another
way.
I want to have a form based on the table type_mail with the field "type". In
this field I will write type of the mail e.g. "registered".
Then I want to have another form, based on the table mail with some fields
and one of the fields is "type". What I want to accomplish is, that when I
add new record, default value of the field [mail]![type] will be value from
the [type_mail]![type].
I wrote = [type_mail]![type] in the Default value of the text box type, but
I recieve just #Name? message.

Thank you
--
Dusan Rybar


George said:
Dear Dusan,

Assumming that the field "type" is related to the table type_mail (if you
have lets say in the table type_mail two fields: ID and meaning, e.g. 1 =
Normal mail, 2 = NonNormal Mail), then to get the default value = Normal
mail, it should be:

= 1

Hope this helps,

George

Ο χÏήστης "Dusan" έγγÏαψε:
I am new in Access, and I have a problem with default value in form.
I would like to set default value of the text box based on the value from
field of the table which is not used in this form.
I have a table type_mail with field "type".
Then I have a table mail with field "type".
I have a form based on the the table mail.
I have set Default value of the text box to =[mail_type]![type] but when I
add new record I recieve #Name? in the text box.
Do you have some suggestions.
Thank you
 
G

Guest

Thank you Steve.

--
Dusan Rybar


SteveS said:
Hi Dusan,

"Type" is a reserved word in Access (one of hundreds) and shouldn't be used
as object names.


You can't refer to a field in a table like that. A table can have zero or
more records, which record is the "default" one?

If you want "registered" to be the default for the "type" field, one way is
to enter "registered" in the default property for the *control*.

It might be easier if you use a combo box based on the table "type_mail";
you can also set the default property for the combo box to "registered".

If you do it your way, the form that is based on the table "type_mail" must
be open.
Let's call it "frmType_Mail".

Then on the form based on the table "mail", you would set the default value
of the *control* bound to the field [mail]![type] using
[Forms]![frmType_Mail]![type].

(I used "type' to be consistant with your terms - I strongly suggest
renaming it)


HTH
--
Steve S
--------------------------------
"Veni, Vidi, Velcro"
(I came; I saw; I stuck around.)


Dusan said:
Thanks Goerge, but this isn't my problem. I will try to explain it another
way.
I want to have a form based on the table type_mail with the field "type". In
this field I will write type of the mail e.g. "registered".
Then I want to have another form, based on the table mail with some fields
and one of the fields is "type". What I want to accomplish is, that when I
add new record, default value of the field [mail]![type] will be value from
the [type_mail]![type].
I wrote = [type_mail]![type] in the Default value of the text box type, but
I recieve just #Name? message.

Thank you
--
Dusan Rybar


George said:
Dear Dusan,

Assumming that the field "type" is related to the table type_mail (if you
have lets say in the table type_mail two fields: ID and meaning, e.g. 1 =
Normal mail, 2 = NonNormal Mail), then to get the default value = Normal
mail, it should be:

= 1

Hope this helps,

George

Ο χÏήστης "Dusan" έγγÏαψε:

I am new in Access, and I have a problem with default value in form.
I would like to set default value of the text box based on the value from
field of the table which is not used in this form.
I have a table type_mail with field "type".
Then I have a table mail with field "type".
I have a form based on the the table mail.
I have set Default value of the text box to =[mail_type]![type] but when I
add new record I recieve #Name? in the text box.
Do you have some suggestions.
Thank you
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top