Question about using the Left function

D

Denniso6

Good day all…,

I want to make the default value of a field named ‘Title’ to be the first 30
character spaces or so of a field named ‘Description’.

Both fields are in the same table, Both are Text fields.

I think I should use the Left function for this.

Can someone provide a soup-to-nuts explanation as to how I accomplish this ?

Thanks - DennisO
 
W

Wayne-I-M

In a query create a calculated column with this

NewTitle:Left([TableName]![Title], 30)

Or

NewTitle: Left([YourTable]![FieldName],30)

Are there always more than 30 characters ?
 
J

Jerry Whittle

You should not do this. Putting the same data in two different fields in a
table is bad database design. What happens if you change the data in the
'Description' field, but forget to change it in the 'Title' field? Then you
have inconsistant data.

If you need something that gives the 'Title' in a query, form, or report,
then use the Left function to extract it from the Description field then and
there. Something like the following in a query:

TheTitle: Left([Description],30)

Also Description is a reserved word and it might give you problems. You
might want to change it to something like txtDescription. Read more about
reserved words at:
http://support.microsoft.com/kb/286335/
 
D

Denniso6

Thanks for the prompt reply Jerry.

You're absolutely right..., I am indeed having problems using the
'Description' moniker. (getting all sorts of unusual errors)

I'll definately assimilate your recommendation.

thanks again.

DennisO
--------------
Jerry Whittle said:
You should not do this. Putting the same data in two different fields in a
table is bad database design. What happens if you change the data in the
'Description' field, but forget to change it in the 'Title' field? Then you
have inconsistant data.

If you need something that gives the 'Title' in a query, form, or report,
then use the Left function to extract it from the Description field then and
there. Something like the following in a query:

TheTitle: Left([Description],30)

Also Description is a reserved word and it might give you problems. You
might want to change it to something like txtDescription. Read more about
reserved words at:
http://support.microsoft.com/kb/286335/
--
Jerry Whittle, Microsoft Access MVP
Light. Strong. Cheap. Pick two. Keith Bontrager - Bicycle Builder.

Denniso6 said:
Good day all…,

I want to make the default value of a field named ‘Title’ to be the first 30
character spaces or so of a field named ‘Description’.

Both fields are in the same table, Both are Text fields.

I think I should use the Left function for this.

Can someone provide a soup-to-nuts explanation as to how I accomplish this ?

Thanks - DennisO
 
D

Denniso6

Thanks so much for the rapid response.

I'll try this and let you know the results.

thanks again.

DennisO
-----------------------
Wayne-I-M said:
In a query create a calculated column with this

NewTitle:Left([TableName]![Title], 30)

Or

NewTitle: Left([YourTable]![FieldName],30)

Are there always more than 30 characters ?

--
Wayne
Manchester, England.



Denniso6 said:
Good day all…,

I want to make the default value of a field named ‘Title’ to be the first 30
character spaces or so of a field named ‘Description’.

Both fields are in the same table, Both are Text fields.

I think I should use the Left function for this.

Can someone provide a soup-to-nuts explanation as to how I accomplish this ?

Thanks - DennisO
 
A

aaron_kempf

I DISAGREE!!!

I have the same data in two different fields _ALL_ the time.

It's called 'computed columns'. or 'calculated columns'.

Is it my fault that your pansy wimpy database doesn't support the 21st
century?

Maybe if you weren't an Access cry baby then you could build light,
cheap, fast db solutions.

-Aaron



You should not do this. Putting the same data in two different fields in a
table is bad database design. What happens if you change the data in the
'Description' field, but forget to change it in the 'Title' field? Then you
have inconsistant data.

If you need something that gives the 'Title' in a query, form, or report,
then use the Left function to extract it from the Description field then and
there. Something like the following in a query:

TheTitle: Left([Description],30)

Also Description is a reserved word and it might give you problems. You
might want to change it to something like txtDescription. Read more about
reserved words at:http://support.microsoft.com/kb/286335/
--
Jerry Whittle, Microsoft Access MVP
Light. Strong. Cheap. Pick two. Keith Bontrager - Bicycle Builder.



Denniso6 said:
Good day all…,
I want to make the default value of a field named ‘Title’ to be thefirst 30
character spaces or so of a field named ‘Description’.
Both fields are in the same table, Both are Text fields.
I think I should use the Left function for this.
Can someone provide a soup-to-nuts explanation as to how I accomplish this ?
Thanks - DennisO- Hide quoted text -

- Show quoted text -
 
D

Denniso6

Hi again Wayne…,

I’m getting some unusual behavior when I place this expression in the
control source on of the ‘Title’ field on my report;
=Left([Cases1]![Description],30)

1. When I first launch the report, a dialog box appears entitled, ‘Enter
Parameter Value’; the table name ‘Cases1’ appears within the dialog along
with a text entry box and ‘OK’ and ‘Cancel’ buttons.
2. Pressing ‘OK reveals the report with ‘#Error’ listed white the ‘Title’
should be.

Any ideas ?

I’m sure I’m not executing your instructions correctly ! Can you tell me
where I’m going wrong ?

Thanks in advance
-------------------
Wayne-I-M said:
In a query create a calculated column with this

NewTitle:Left([TableName]![Title], 30)

Or

NewTitle: Left([YourTable]![FieldName],30)

Are there always more than 30 characters ?

--
Wayne
Manchester, England.



Denniso6 said:
Good day all…,

I want to make the default value of a field named ‘Title’ to be the first 30
character spaces or so of a field named ‘Description’.

Both fields are in the same table, Both are Text fields.

I think I should use the Left function for this.

Can someone provide a soup-to-nuts explanation as to how I accomplish this ?

Thanks - DennisO
 
D

Denniso6

Hi again Jerry...,

Thanks so much for the guidance. This works like a champ !!

I apologize for the unfortunate comment by the other respondant.

thanks again !

Denniso
-----------------------
Jerry Whittle said:
You should not do this. Putting the same data in two different fields in a
table is bad database design. What happens if you change the data in the
'Description' field, but forget to change it in the 'Title' field? Then you
have inconsistant data.

If you need something that gives the 'Title' in a query, form, or report,
then use the Left function to extract it from the Description field then and
there. Something like the following in a query:

TheTitle: Left([Description],30)

Also Description is a reserved word and it might give you problems. You
might want to change it to something like txtDescription. Read more about
reserved words at:
http://support.microsoft.com/kb/286335/
--
Jerry Whittle, Microsoft Access MVP
Light. Strong. Cheap. Pick two. Keith Bontrager - Bicycle Builder.

Denniso6 said:
Good day all…,

I want to make the default value of a field named ‘Title’ to be the first 30
character spaces or so of a field named ‘Description’.

Both fields are in the same table, Both are Text fields.

I think I should use the Left function for this.

Can someone provide a soup-to-nuts explanation as to how I accomplish this ?

Thanks - DennisO
 
J

Jerry Whittle

AK is an amusing troll. I just consider the souce when he replies to anyone.
--
Jerry Whittle, Microsoft Access MVP
Light. Strong. Cheap. Pick two. Keith Bontrager - Bicycle Builder.


Denniso6 said:
Hi again Jerry...,

Thanks so much for the guidance. This works like a champ !!

I apologize for the unfortunate comment by the other respondant.

thanks again !

Denniso
-----------------------
Jerry Whittle said:
You should not do this. Putting the same data in two different fields in a
table is bad database design. What happens if you change the data in the
'Description' field, but forget to change it in the 'Title' field? Then you
have inconsistant data.

If you need something that gives the 'Title' in a query, form, or report,
then use the Left function to extract it from the Description field then and
there. Something like the following in a query:

TheTitle: Left([Description],30)

Also Description is a reserved word and it might give you problems. You
might want to change it to something like txtDescription. Read more about
reserved words at:
http://support.microsoft.com/kb/286335/
--
Jerry Whittle, Microsoft Access MVP
Light. Strong. Cheap. Pick two. Keith Bontrager - Bicycle Builder.

Denniso6 said:
Good day all…,

I want to make the default value of a field named ‘Title’ to be the first 30
character spaces or so of a field named ‘Description’.

Both fields are in the same table, Both are Text fields.

I think I should use the Left function for this.

Can someone provide a soup-to-nuts explanation as to how I accomplish this ?

Thanks - DennisO
 

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