A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Database Design
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Adding a character in front of a field



 
 
Thread Tools Display Modes
  #1  
Old August 9th, 2004, 08:03 PM
Sunny Sethi
external usenet poster
 
Posts: n/a
Default Adding a character in front of a field

Hi,

In a table I have 1 field(expense_id) which is a auto-
number field.

I want to create another field using the same value as the
(expense_id) BUT appending H in front of it.

e.g. expense_id - value = 1
refernce_if - value = H1

Thanks
Sunny

  #2  
Old August 9th, 2004, 08:40 PM
'69 Camaro
external usenet poster
 
Posts: n/a
Default Adding a character in front of a field

Hi, Sunny.

1.) Create a new field in your table, called reference_if.
2.) Create a new query and open the SQL View pane and write a SQL statement
such as the following:

UPDATE myTableName
SET reference_if = "H" & expense_id;

3.) Run the query.

HTH.

Gunny

See http://www.QBuilt.com for all your database needs.
See http://www.Access.QBuilt.com for Microsoft Access tips.


"Sunny Sethi" wrote in message
...
Hi,

In a table I have 1 field(expense_id) which is a auto-
number field.

I want to create another field using the same value as the
(expense_id) BUT appending H in front of it.

e.g. expense_id - value = 1
refernce_if - value = H1

Thanks
Sunny



  #3  
Old August 9th, 2004, 10:55 PM
Douglas J. Steele
external usenet poster
 
Posts: n/a
Default Adding a character in front of a field

NO! That's a violation of relational database theory: a field in a table
should not be totally derivable from other fields in the table.

Instead, create a query that has a computed field reference_if: "H" &
expense_id, then use the query wherever you would otherwise have used the
table.

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)



"'69 Camaro" wrote in message
...
Hi, Sunny.

1.) Create a new field in your table, called reference_if.
2.) Create a new query and open the SQL View pane and write a SQL

statement
such as the following:

UPDATE myTableName
SET reference_if = "H" & expense_id;

3.) Run the query.

HTH.

Gunny

See http://www.QBuilt.com for all your database needs.
See http://www.Access.QBuilt.com for Microsoft Access tips.


"Sunny Sethi" wrote in message
...
Hi,

In a table I have 1 field(expense_id) which is a auto-
number field.

I want to create another field using the same value as the
(expense_id) BUT appending H in front of it.

e.g. expense_id - value = 1
refernce_if - value = H1

Thanks
Sunny





  #4  
Old August 10th, 2004, 01:28 AM
'69 Camaro
external usenet poster
 
Posts: n/a
Default Adding a character in front of a field

Thanks, Doug, for that very important reminder! I forgot to mention it in
my earlier post, obviously. However, there are a few reasons to temporarily
(or permanently) violate the rules of relational database theory, such as
when the need arises to match table structures or to improve the performance
of queries. The bottom line is that one needs to be fully grounded in
proper relational database theory, and then know when relational database
rules can be bent.

Gunny

"Douglas J. Steele" wrote in message
...
NO! That's a violation of relational database theory: a field in a table
should not be totally derivable from other fields in the table.

Instead, create a query that has a computed field reference_if: "H" &
expense_id, then use the query wherever you would otherwise have used the
table.

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)



"'69 Camaro" wrote in message
...
Hi, Sunny.

1.) Create a new field in your table, called reference_if.
2.) Create a new query and open the SQL View pane and write a SQL

statement
such as the following:

UPDATE myTableName
SET reference_if = "H" & expense_id;

3.) Run the query.

HTH.

Gunny

See http://www.QBuilt.com for all your database needs.
See http://www.Access.QBuilt.com for Microsoft Access tips.


"Sunny Sethi" wrote in message
...
Hi,

In a table I have 1 field(expense_id) which is a auto-
number field.

I want to create another field using the same value as the
(expense_id) BUT appending H in front of it.

e.g. expense_id - value = 1
refernce_if - value = H1

Thanks
Sunny







 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
adding text in a currency field Linda Database Design 4 June 7th, 2004 07:10 PM
Adding character to text string Adam Worksheet Functions 2 September 25th, 2003 08:58 AM
Adding character to text string Rekoj Worksheet Functions 0 September 24th, 2003 10:40 PM


All times are GMT +1. The time now is 09:25 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.