Create a field from another field

  • Thread starter Thread starter wmcgan
  • Start date Start date
W

wmcgan

I want to create a field that will contain the first three characters from
another field.

I have a field that contains as many as six characters. The first three
characters indicate the department that this record applies to. The
remaining characters further break down the department into sub-departments.

I want to create a field that will only show those first three characters so
I can further query by the main department.

Is this possible?
 
I am getting an error message "The expression you entered has a function
containing the wrong number of arguments".

I am in a Select Query.

Golfinray said:
New Field:trim([yourfield],3)

wmcgan said:
I want to create a field that will contain the first three characters from
another field.

I have a field that contains as many as six characters. The first three
characters indicate the department that this record applies to. The
remaining characters further break down the department into sub-departments.

I want to create a field that will only show those first three characters so
I can further query by the main department.

Is this possible?
 
try New field:left([yourfieldname],3)

wmcgan said:
I am getting an error message "The expression you entered has a function
containing the wrong number of arguments".

I am in a Select Query.

Golfinray said:
New Field:trim([yourfield],3)

wmcgan said:
I want to create a field that will contain the first three characters from
another field.

I have a field that contains as many as six characters. The first three
characters indicate the department that this record applies to. The
remaining characters further break down the department into sub-departments.

I want to create a field that will only show those first three characters so
I can further query by the main department.

Is this possible?
 
I want to create a field that will contain the first three characters from
another field.

I have a field that contains as many as six characters. The first three
characters indicate the department that this record applies to. The
remaining characters further break down the department into sub-departments.

I want to create a field that will only show those first three characters so
I can further query by the main department.

Is this possible?

It's possible; it's also unnecessary and it's also incorrect design!

If the first three characters are the department, and the next three are the
subdepartment, you can and should use TWO three-byte fields, Department and
Subdepartment. You can easily concatenate them for display purposes:

FullDept: [Department] & [Subdepartment]

as a calculated field in a query.

To search your existing field for department use a criterion of

LIKE [Enter 3-letter department code:] & "*"

This will find any record where the first three letters are the user's entry.

Storing the same three letters in two fields in a Table would be redundant and
would risk data errors, such as the six-letter field being "ABCWWW" and the
three-character field being "BCD".
 
Back
Top