how do i fill in a text control by concatenating 2 other strings.

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a form (Flat) that is already full, we have decided to add another
field on this form which will make life easier on other tables. This cell is
a combination of flatID and Blockey which are the composite key for the
table.

Ive been trying to use a form to take those 2 values and put them into
another text box which ive added to the form and is bound to the underlying
table called Flatref. The VBscript i have made for this is shown below and
works fine in debug mode but when i try to run it normally it doesnt seem to
do anything. Can anyone explain why this is so?


Private Sub flatref_Click()

Forms![Flat]![flatref] = Forms![Flat]![Blockey] & Forms![Flat]![flatID]

End Sub
 
You should not store a calculated field in a table. You already have the
two data fields. When you need to use them somewhere, just combine them at
that time.

It is redundant and poor database design to store a calculated field. This
is addressed in the newsgroups at least once a day and the advise is always
the same.

Rick B
 
OK so suppose i had removed all the recurring fields (as i had after i posted
this request) so that the data i wanted to put into my table was a
concatenation of 2 other fields one of which the user has to input anyway:

Forms![Student-Rooms]![RoomNum]

and the other which is on another table called Flat and is called Flatref:

Thanks
Amit




Rick B said:
You should not store a calculated field in a table. You already have the
two data fields. When you need to use them somewhere, just combine them at
that time.

It is redundant and poor database design to store a calculated field. This
is addressed in the newsgroups at least once a day and the advise is always
the same.

Rick B


DowningDevelopments said:
I have a form (Flat) that is already full, we have decided to add another
field on this form which will make life easier on other tables. This cell is
a combination of flatID and Blockey which are the composite key for the
table.

Ive been trying to use a form to take those 2 values and put them into
another text box which ive added to the form and is bound to the underlying
table called Flatref. The VBscript i have made for this is shown below and
works fine in debug mode but when i try to run it normally it doesnt seem to
do anything. Can anyone explain why this is so?


Private Sub flatref_Click()

Forms![Flat]![flatref] = Forms![Flat]![Blockey] & Forms![Flat]![flatID]

End Sub
 
Just pull both items to your current form. (even if they are not both
visible).

Then in an unbounvd field (of in the default of a bound field) put something
like:

=[RoomNum] & [Flatref]


Rick B


DowningDevelopments said:
OK so suppose i had removed all the recurring fields (as i had after i posted
this request) so that the data i wanted to put into my table was a
concatenation of 2 other fields one of which the user has to input anyway:

Forms![Student-Rooms]![RoomNum]

and the other which is on another table called Flat and is called Flatref:

Thanks
Amit




Rick B said:
You should not store a calculated field in a table. You already have the
two data fields. When you need to use them somewhere, just combine them at
that time.

It is redundant and poor database design to store a calculated field. This
is addressed in the newsgroups at least once a day and the advise is always
the same.

Rick B


in message news:[email protected]...
I have a form (Flat) that is already full, we have decided to add another
field on this form which will make life easier on other tables. This
cell
is
a combination of flatID and Blockey which are the composite key for the
table.

Ive been trying to use a form to take those 2 values and put them into
another text box which ive added to the form and is bound to the underlying
table called Flatref. The VBscript i have made for this is shown below and
works fine in debug mode but when i try to run it normally it doesnt
seem
to
do anything. Can anyone explain why this is so?


Private Sub flatref_Click()

Forms![Flat]![flatref] = Forms![Flat]![Blockey] & Forms![Flat]![flatID]

End Sub
 
Thanks,

yeah ive been doing that, but i want to store that new value in a table

the expression ive been using was:

Dlookup("[flatref]",[flat],[testdb1]) & [RoomNum]

and it gives me the correct property but i need a way to store it in the
Student-Room table

Amit
Rick B said:
Just pull both items to your current form. (even if they are not both
visible).

Then in an unbounvd field (of in the default of a bound field) put something
like:

=[RoomNum] & [Flatref]


Rick B


DowningDevelopments said:
OK so suppose i had removed all the recurring fields (as i had after i posted
this request) so that the data i wanted to put into my table was a
concatenation of 2 other fields one of which the user has to input anyway:

Forms![Student-Rooms]![RoomNum]

and the other which is on another table called Flat and is called Flatref:

Thanks
Amit




Rick B said:
You should not store a calculated field in a table. You already have the
two data fields. When you need to use them somewhere, just combine them at
that time.

It is redundant and poor database design to store a calculated field. This
is addressed in the newsgroups at least once a day and the advise is always
the same.

Rick B


in message I have a form (Flat) that is already full, we have decided to add another
field on this form which will make life easier on other tables. This cell
is
a combination of flatID and Blockey which are the composite key for the
table.

Ive been trying to use a form to take those 2 values and put them into
another text box which ive added to the form and is bound to the
underlying
table called Flatref. The VBscript i have made for this is shown below and
works fine in debug mode but when i try to run it normally it doesnt seem
to
do anything. Can anyone explain why this is so?


Private Sub flatref_Click()

Forms![Flat]![flatref] = Forms![Flat]![Blockey] & Forms![Flat]![flatID]

End Sub
 
Back
Top