473,394 Members | 1,866 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Using Left Function in table design.

I am trying to create a simple database, but it's proving too complex
for me!!!
I have only just started a new database and am trying to have two
fields in a table:
the first holding the first name of a person (FirstName) and the second
to be the first charactrer of that name.

i am using the default value property for the second field of
"=Left([FirstName],1)", but i am getting error messages when tryign to
save it.

does anyone know what i am doing wrong, i would like it so that the
first could be entered as "Jason" and the second field would
automatically enter "J".

can anyone helps, thanks

Jason

Jan 25 '06 #1
2 5201
On 25 Jan 2006 01:58:32 -0800, "Jason" <wi*********@gmail.com> wrote:
I am trying to create a simple database, but it's proving too complex
for me!!!
I have only just started a new database and am trying to have two
fields in a table:
the first holding the first name of a person (FirstName) and the second
to be the first charactrer of that name.

i am using the default value property for the second field of
"=Left([FirstName],1)", but i am getting error messages when tryign to
save it.

does anyone know what i am doing wrong, i would like it so that the
first could be entered as "Jason" and the second field would
automatically enter "J".

can anyone helps, thanks

Jason


You can't set a calculated default value like this in a table.
However from your description, there is no need to have the 2nd field in the table to store the first letter of the
first name. This value can be calculated whenever needed using the same formula you are attempting to set with the
default value.

=Left([FirstName],1)

In any form or report where you need to display the first letter, use this formula as the controlsource of a textbox.

Basic rule of database design - you *normally* do not store in a table that which can be calculated from existing data.

Wayne Gillespie
Gosford NSW Australia
Jan 25 '06 #2
Simple Rule:

Tables are for storage of raw data.
Queries are for presenting data for use in forms and reports.
so...
Store your data in a table
Complete calculations and data modification in queries, then base your
form or report on that query.

You can use an "Unbound" control on a form/report such as a textbox to
do the same calculations on the form or report, but in my experience it
is often easier and quicker (to run/load) to do the calcs in the query
that the form/report is based on, and then add a control based on the
calc into the form/report...

eg
in your table, you will have only one field [FirstName]
in the query based on your table, you will have the field [FirstName],
and then in another new query field type "Initial:
Left([FirstName],1)". so now you have the raw data and the calculated
field. base you table/report on this query and you will have two
controls called [FirstName] and [Initial].

if you wanted to do the calc on a form or report without writing the
query, on a form in design view, in an Unbound (new) text box type
"=Left([FirstName],1)" in the Control Source field of the Data tab of
the properties box.

remember there is always one or two ways of doing almost anything with
data in MS Access

good luck

Jason wrote:
I am trying to create a simple database, but it's proving too complex
for me!!!
I have only just started a new database and am trying to have two
fields in a table:
the first holding the first name of a person (FirstName) and the second
to be the first charactrer of that name.

i am using the default value property for the second field of
"=Left([FirstName],1)", but i am getting error messages when tryign to
save it.

does anyone know what i am doing wrong, i would like it so that the
first could be entered as "Jason" and the second field would
automatically enter "J".

can anyone helps, thanks

Jason


Jan 25 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

28
by: Anthony Williams | last post by:
Good morning, I'm currently designing a site, using CSS, and wish to create a variable width two-column layout, with header and footer, and one fixed-width column on the left. Previously, I...
3
by: davidkarlsson74 | last post by:
Error: document.getElementById("folderMenu").cells has no properties File: http://www.volkswagen.se/tillbehor/js/foldermenu.js Rad: 49 The function activates different DIV:s, but doesn't seem to...
3
by: Random Person | last post by:
Does anyone know how to use VBA to relink tables between two MS Access databases? We have two databases, one with VBA code and the other with data tables. The tables are referenced by linked...
11
by: Grasshopper | last post by:
Hi, I am automating Access reports to PDF using PDF Writer 6.0. I've created a DTS package to run the reports and schedule a job to run this DTS package. If I PC Anywhere into the server on...
1
by: Daveyk0 | last post by:
Hello there, I have a front end database that I have recently made very many changes to to allow off-line use. I keep copies of the databases on my hard drive and link to them rather than the...
12
by: veaux | last post by:
Question about joins in queries. I have 2 tables with a field called "ID". Table 1 Rec1 = Jan12FredFlintstone Rec2 = Feb01WilmaRubble Table 2 Rec1 = Jan12BarneyRubble Rec2 = Mar03SamSlate
2
by: davidson1 | last post by:
Hai friends..for menu to use in my website..i found in one website....pl look below website.... http://www.dynamicdrive.com/dynamicindex1/omnislide/index.htm i downloaded 2 files.... ...
3
by: sejal17 | last post by:
hello Can any one tell me how to read multiple worksheets from a single excel file.I have stored that excel in xml file.so i want to read that xml that has multiple worksheet.And i want to store...
3
by: nathanwb | last post by:
I have the following php code, at the top I am pulling a piece of data from a query and I echo the results with no problem, I am using Ajax with this page as well and further down the page when I...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.