Concatenating in a form field

S

Stahlhelm

I am relatively new to Access but wonder if someone can point me in the
right direction with a problem.

I am trying to create a control that has the value of a table field followed
by the word "account".

I have tried the following code as the control source:

=[transactions]![account] & "Account"

This always displays #error.
The table and field names are perfectly correct but nothing I try will give
anything but either #error or #name? This is frustrating me as every website
I have tried suggests that this should work.

Please help me....thanks in advance
 
D

Douglas J. Steele

You can't refer to tables and fields like that.

If it's a bound form, and Account is a field in the underlying recordsource,
just use

=[Account] & " Account"

If it's not a bound form, or if Account is not a field in the underlying
recordsource, try using DLookup:

=DLookup("[Account]", "[Transactions]) & " Account"

Of course, this will only work if there's a single row in the Transaction
table (otherwise you won't have any way of controlling the row from which
DLookup gets the value of Account ), but then your original code suffers
from the same problem.
 
Top