Fields in Table

A

Allison

I'm trying to use a Visual Basic code to design a field
that is a result of two concatenated fields. Someone
suggested that I use something like this:

New Grant ID= FullGrant Number & ""Right(CAN,4) to bring
the fields together as one.(I'm not sure where this should
go) I also had a friend to show me a
Visual Basic code that concatenates two fields
based on names something like this:


Public Function Full Name() As String

FullName = FistName& "" &LastName


End Function

If I perform an event procedure that automatically fills
this field with the concatenated fields each time I open
my table how would I set this up?? Keep in mind I'm using
a make table query and all the other fields are from a
ODBC source. I added one field in the table and labled it
NEW GRANT NUMBER.
 
T

Tim Ferguson

I'm trying to use a Visual Basic code to design a field
that is a result of two concatenated fields. Someone
suggested that I use something like this:

Then they shouldn't have. There is no way in Access to keep the three
fields in synchronisation; and even if there were, it would be a waste of
disk space, and a waste of time (it takes longer to read the third string
from disk that it would to recreate it from the other two).

Do the concatenation either (1) in the query or (2) in the text box on the
form or report.

1) Put this in the top line of an empty column in the query designer:

NewGrantID: [Full Grant Number] & "" & Right([CAN],4)

2) Put this in the ControlSource property of a text box on a form:

=[Full Grant Number] & "" & Right([CAN],4)

Hope that helps


Tim F
 
J

John Vinson

I'm trying to use a Visual Basic code to design a field
that is a result of two concatenated fields. Someone
suggested that I use something like this:

Storing such a field in your table is almost certainly a VERY BAD IDEA
and is not necessary. You can concatenate two fields from a table for
display purposes in a Query or in the Control Source of a textbox on a
form or report.
New Grant ID= FullGrant Number & ""Right(CAN,4) to bring

This is close but has two problems. If the name of the field is
"Fullgrant Number" with a blank, you must enclose it in square
brackets; and the "" is not needed and in fact makes the expression
invalid. You can put

New Grant ID: [FullGrant Number] & Right([CAN], 4)

in a vacant FIeld cell in a query (even a make-table query if you
insist).
If I perform an event procedure that automatically fills
this field with the concatenated fields each time I open
my table how would I set this up?? Keep in mind I'm using
a make table query and all the other fields are from a
ODBC source. I added one field in the table and labled it
NEW GRANT NUMBER.

This field SHOULD NOT EXIST if you're keeping the components and if
they each have their own independent existance.
 

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