Reference field in combo box value

  • Thread starter Thread starter HilcrRWise
  • Start date Start date
H

HilcrRWise

I have a combo box that has various statements that when selected cop
on to the end of the value in a memo field. What I want to be able t
do is to reference a different field on a form in one of thes
statements. Eg: a statement in the combo box says something lik
"<<FORENAME>> has worked very hard this year." when this statement i
selected the database should look to see what value is currently bein
shown in the Forename field and the value copied to the memo fiel
should read "Bob has worked...". The 'FORENAME' reference does no
always come at the start or the end of the statement.

Is this possible?

I tried using the replace function on the after update option of th
combo box
Replace([Comment],"<<FORENAME>>",[ForeName])
but kept getting 'Compile Error: Expected: =
 
HilcrRWise said:
I have a combo box that has various statements that when selected copy
on to the end of the value in a memo field. What I want to be able to
do is to reference a different field on a form in one of these
statements. Eg: a statement in the combo box says something like
"<<FORENAME>> has worked very hard this year." when this statement is
selected the database should look to see what value is currently being
shown in the Forename field and the value copied to the memo field
should read "Bob has worked...". The 'FORENAME' reference does not
always come at the start or the end of the statement.

Is this possible?

I tried using the replace function on the after update option of the
combo box
Replace([Comment],"<<FORENAME>>",[ForeName])
but kept getting 'Compile Error: Expected: ='

Replace is a function that returns a value. You need to
assign that value to something. Mayne like this(??)

Me.memofield = Replace([Comment],"<<FORENAME>>",[ForeName])
 
Replace is a function so it returns a value. You need to give it a
variable to return the value to. So basically you need to do something
like this:


Code:
 
MemoFieldName = EmployeeFieldName & ComboBoxName.
If you need to place the name into the statement vs beginning or end then
set up the combo box with three columns, the first one containing the Psuedo
phrase, the second column the beginning of the sentence and the third with
the end of the sentence. Now code it like so:
MemoFieldName = ComboBoxName.Column(1) & EmployeeFieldName &
ComboBoxName.Column(2)
THT
Bill
 
Back
Top