Receiving field has no value error when it does

S

super_spazz

I am trying to populate a field with data from two other fields on the same
form. All data is manually entered, no db lookup.

So, here is what I am trying to do:

AllSameForm

Field1 contains "this"
Field2 contains "that"

I want Field3 to auto populate with the value "this-that"

Field1 is manually entered
Field2 is manually entered
Field3 I want values of field1 and field2 concatenated with a dash in
between the two values. My code for Field3 in the Control Source box is
=[Field1] & "-" & [Field3].

The field *does* populate with the correct output. The problem is, when I
am finished and want to close the form, it complains that Field3 needs to
contain a value. I am confused because it auto-populated and I can see it
with my eyes. Not sure why Access believes there is no data in this field
when there.

Any help is greatly appreciated. Thank you.

Jessica
 
S

super_spazz

Correction:

I had a typo. Code for Field3 is this:
=[Field1] & "-" & [Field2]
 
B

Bob Quintal

Correction:

I had a typo. Code for Field3 is this:
=[Field1] & "-" & [Field2]

super_spazz said:
I am trying to populate a field with data from two other fields
on the same form. All data is manually entered, no db lookup.

So, here is what I am trying to do:

AllSameForm

Field1 contains "this"
Field2 contains "that"

I want Field3 to auto populate with the value "this-that"

Field1 is manually entered
Field2 is manually entered
Field3 I want values of field1 and field2 concatenated with a
dash in between the two values. My code for Field3 in the
Control Source box is =[Field1] & "-" & [Field3].

The field *does* populate with the correct output. The problem
is, when I am finished and want to close the form, it complains
that Field3 needs to contain a value. I am confused because it
auto-populated and I can see it with my eyes. Not sure why
Access believes there is no data in this field when there.

Any help is greatly appreciated. Thank you.

Jessica
The reason that Access complains is that you are calculating and
storing a value into a control on the form, but not saving it to the
table. The table has a required property set on that field, so
that's where the complaint by access comes from.

It is bad design practice to store calculated values in a table if
the constituent parts of the calculation are also stored.

You can always generate the concatenated value in any query, form or
report when needed.

If you insist on storing the value you'll have to bind the control
box on the form to [Field3], and move the calculation to Visual
Basic in the After_Update events for [Field1] and [Field2]
 

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