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 » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

populating field



 
 
Thread Tools Display Modes
  #1  
Old November 3rd, 2009, 03:36 AM posted to microsoft.public.access.forms
JY
external usenet poster
 
Posts: 13
Default populating field

Hello,
i would like to be able to automatically populate a field in a table from a
form

the fields are as follow:
FirstName
LastName
E-mail

i am able to concatenate the field in the form but i'm not sure how to
submit my result to the table.

the formula in the e-mail field in the form is
[FirstName] & "."& [LastName] & "

how do i submit this to the table


  #2  
Old November 3rd, 2009, 04:05 AM posted to microsoft.public.access.forms
Tom van Stiphout[_2_]
external usenet poster
 
Posts: 1,653
Default populating field

On Mon, 2 Nov 2009 19:36:05 -0800, JY
wrote:

Well, one could argue that there is no need to store Email in a table,
since it is a calculated value, and an important relational design
rule says you should not store calculated fields. What if someone
changes his or her lastname? Will you not forget to also update the
email field?

If I did not convince you, you could proceed like this: in both the
FirstName_AfterUpdate and the LastName_AfterUpdate event write:
Me.myEmailControl = CalculateEmail()

Then write a function:
private function CalculateEmail() as string
CalculateEmail = Nz(Me.myFirstNameControl,"") & "." &
Nz(Me.myLastNameControl,"") & "
end function

-Tom.
Microsoft Access MVP


Hello,
i would like to be able to automatically populate a field in a table from a
form

the fields are as follow:
FirstName
LastName
E-mail

i am able to concatenate the field in the form but i'm not sure how to
submit my result to the table.

the formula in the e-mail field in the form is
[FirstName] & "."& [LastName] & "

how do i submit this to the table

  #3  
Old November 3rd, 2009, 04:57 AM posted to microsoft.public.access.forms
John W. Vinson
external usenet poster
 
Posts: 18,261
Default populating field

On Mon, 2 Nov 2009 19:36:05 -0800, JY wrote:

Hello,
i would like to be able to automatically populate a field in a table from a
form

the fields are as follow:
FirstName
LastName
E-mail

i am able to concatenate the field in the form but i'm not sure how to
submit my result to the table.

the formula in the e-mail field in the form is
[FirstName] & "."& [LastName] & "

how do i submit this to the table


In addition to the very valid problems Tom mentions, what if you happen to
have two employees who happen to have the same first and last name? A good
many year ago I once worked with Dr. Lawrence David Wise and his colleague,
Dr. Lawrence David Wise. Which one gets their name as their email?

--

John W. Vinson [MVP]
  #4  
Old November 9th, 2009, 09:57 PM posted to microsoft.public.access.forms
JY
external usenet poster
 
Posts: 13
Default populating field

Thanks for your response but it doesn't seem to be working. i'm not sure what
i'm doing wrong. i new to Access and creating forms

In my form i added
Me.myEmailControl = CalculateEmail() in the after update in the [Event
Procedure] of FirstName & LastName field.

then i added
private function CalculateEmail() as string
CalculateEmail = Nz(Me.myFirstNameControl,"") & "." & Nz
Me.myLastNameControl,"") & "
end function

when i open my form and enter the firstName and the LastName in those the
e-mail field those not populate. i must have mist something.


"Tom van Stiphout" wrote:

On Mon, 2 Nov 2009 19:36:05 -0800, JY
wrote:

Well, one could argue that there is no need to store Email in a table,
since it is a calculated value, and an important relational design
rule says you should not store calculated fields. What if someone
changes his or her lastname? Will you not forget to also update the
email field?

If I did not convince you, you could proceed like this: in both the
FirstName_AfterUpdate and the LastName_AfterUpdate event write:
Me.myEmailControl = CalculateEmail()

Then write a function:
private function CalculateEmail() as string
CalculateEmail = Nz(Me.myFirstNameControl,"") & "." &
Nz(Me.myLastNameControl,"") & "
end function

-Tom.
Microsoft Access MVP


Hello,
i would like to be able to automatically populate a field in a table from a
form

the fields are as follow:
FirstName
LastName
E-mail

i am able to concatenate the field in the form but i'm not sure how to
submit my result to the table.

the formula in the e-mail field in the form is
[FirstName] & "."& [LastName] & "

how do i submit this to the table

.

 




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


All times are GMT +1. The time now is 09:46 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.