Combining to Fields!!!

  • Thread starter Thread starter Richard C
  • Start date Start date
R

Richard C

I have two fields within a table called, 1stName and
Surname. How could I create a third field called NameComb,
which is simplay; [1stName] + [Surname] I tried adding
that to Validation rule and validation txt and it didnt
work. They are both strings and should be added together,
without the user inputting anything!!!

How would you do this?

Richard
 
Richard,

The easiest way to do it is to add the following event procedures:

Private Sub Ctl1stName_AfterUpdate()
Me!NameComb = Me!Ctl1stName & " " Me!Surname
End Sub

Private Sub SurName_AfterUpdate()
Me!NameComb = Me!Ctl1stName & " " Me!Surname
End Sub

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia
 
I thought the easiest way would be to not store the combined value since it
is always easily combined in a query or control source.

--
Duane Hookom
MS Access MVP
--

Graham R Seach said:
Richard,

The easiest way to do it is to add the following event procedures:

Private Sub Ctl1stName_AfterUpdate()
Me!NameComb = Me!Ctl1stName & " " Me!Surname
End Sub

Private Sub SurName_AfterUpdate()
Me!NameComb = Me!Ctl1stName & " " Me!Surname
End Sub

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia
---------------------------

Richard C said:
I have two fields within a table called, 1stName and
Surname. How could I create a third field called NameComb,
which is simplay; [1stName] + [Surname] I tried adding
that to Validation rule and validation txt and it didnt
work. They are both strings and should be added together,
without the user inputting anything!!!

How would you do this?

Richard
 
I assumed Richard was actually wanting to use the concatenated name on a
form; that's why I gave him an event procedure, which as you know, isn't
available for tables. I figured that if he'd wanted to store the name in a
table, he'd have come back to say so.

I suppose I should have been a tad more explicit.

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia
---------------------------

Duane Hookom said:
I thought the easiest way would be to not store the combined value since it
is always easily combined in a query or control source.

--
Duane Hookom
MS Access MVP
--

Graham R Seach said:
Richard,

The easiest way to do it is to add the following event procedures:

Private Sub Ctl1stName_AfterUpdate()
Me!NameComb = Me!Ctl1stName & " " Me!Surname
End Sub

Private Sub SurName_AfterUpdate()
Me!NameComb = Me!Ctl1stName & " " Me!Surname
End Sub

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia
---------------------------

Richard C said:
I have two fields within a table called, 1stName and
Surname. How could I create a third field called NameComb,
which is simplay; [1stName] + [Surname] I tried adding
that to Validation rule and validation txt and it didnt
work. They are both strings and should be added together,
without the user inputting anything!!!

How would you do this?

Richard
 
I was getting some psychic messages based on "Validation rule and validation
txt" ;-)

--
Duane Hookom
MS Access MVP


Graham R Seach said:
I assumed Richard was actually wanting to use the concatenated name on a
form; that's why I gave him an event procedure, which as you know, isn't
available for tables. I figured that if he'd wanted to store the name in a
table, he'd have come back to say so.

I suppose I should have been a tad more explicit.

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia
---------------------------

Duane Hookom said:
I thought the easiest way would be to not store the combined value since it
is always easily combined in a query or control source.

--
Duane Hookom
MS Access MVP
--

Graham R Seach said:
Richard,

The easiest way to do it is to add the following event procedures:

Private Sub Ctl1stName_AfterUpdate()
Me!NameComb = Me!Ctl1stName & " " Me!Surname
End Sub

Private Sub SurName_AfterUpdate()
Me!NameComb = Me!Ctl1stName & " " Me!Surname
End Sub

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia
---------------------------

I have two fields within a table called, 1stName and
Surname. How could I create a third field called NameComb,
which is simplay; [1stName] + [Surname] I tried adding
that to Validation rule and validation txt and it didnt
work. They are both strings and should be added together,
without the user inputting anything!!!

How would you do this?

Richard
 
Back
Top