Concatenate function

R

Revned

hi,
i have two different forms, the first one i name it Customer
the second form i name it Order Form....

in my Customer form i have a button [Place Order] with the event
DoCmd.OpenForm "Order Forms", acNormal, , , acFormAdd

Forms![Order Forms]![Text13].Value = Me.Text13.Value
Forms![Order Forms]![Text15].Value = Me.Text15.Value
Forms![Order Forms]![Text19].Value = Me.Text19.Value

Forms![Order Forms]![Combo61].SetFocus

DoCmd.Close acForm, "Customer", acSaveYes

this command will populate the information to my Order Forms such as
customer name [First Name] and [Last Time], the code works will

THE PROBLEM OCCURS when I use concatente in my Order Forms text box
txtCustomerName, i set the control source to = [First Name] & " " & [Last
Name]
it works for some time but when i close the Order Forms
and open my Customer form then click on my cmdPlaceOrder button

i have this Error
'Run Time Error '2448':
and highlights this code
Forms![Order Forms]![Text15].Value = Me.Text15.Value

with a message box
'You can't assign a value to thisobject.

pls. is there a way tofix this error...

thank you very much in advance a spending a time for this question
 
M

Marshall Barton

Revned said:
i have two different forms, the first one i name it Customer
the second form i name it Order Form....

in my Customer form i have a button [Place Order] with the event
DoCmd.OpenForm "Order Forms", acNormal, , , acFormAdd

Forms![Order Forms]![Text13].Value = Me.Text13.Value
Forms![Order Forms]![Text15].Value = Me.Text15.Value
Forms![Order Forms]![Text19].Value = Me.Text19.Value

Forms![Order Forms]![Combo61].SetFocus

DoCmd.Close acForm, "Customer", acSaveYes

this command will populate the information to my Order Forms such as
customer name [First Name] and [Last Time], the code works will

THE PROBLEM OCCURS when I use concatente in my Order Forms text box
txtCustomerName, i set the control source to = [First Name] & " " & [Last
Name]
it works for some time but when i close the Order Forms
and open my Customer form then click on my cmdPlaceOrder button

i have this Error
'Run Time Error '2448':
and highlights this code
Forms![Order Forms]![Text15].Value = Me.Text15.Value

with a message box
'You can't assign a value to thisobject.


The reason you are getting the message is because a text box
with an expression is calculating its value and it can not
be set any other way (nor can or should it be bound to a
field in a table).

If the text box is supposed to be calculated (per your
concatenation expression), why are you trying to set its
value? The "fix" should be to just remove the code that's
trying to set the value.
 
R

Revned

the purpose i have this is that after i enter data or customer info
from this form he will populate the some info my Order Form

there is no other way to fix this or can you give another to code to work on
this

thank you very much Marshall Barton

Marshall Barton said:
Revned said:
i have two different forms, the first one i name it Customer
the second form i name it Order Form....

in my Customer form i have a button [Place Order] with the event
DoCmd.OpenForm "Order Forms", acNormal, , , acFormAdd

Forms![Order Forms]![Text13].Value = Me.Text13.Value
Forms![Order Forms]![Text15].Value = Me.Text15.Value
Forms![Order Forms]![Text19].Value = Me.Text19.Value

Forms![Order Forms]![Combo61].SetFocus

DoCmd.Close acForm, "Customer", acSaveYes

this command will populate the information to my Order Forms such as
customer name [First Name] and [Last Time], the code works will

THE PROBLEM OCCURS when I use concatente in my Order Forms text box
txtCustomerName, i set the control source to = [First Name] & " " & [Last
Name]
it works for some time but when i close the Order Forms
and open my Customer form then click on my cmdPlaceOrder button

i have this Error
'Run Time Error '2448':
and highlights this code
Forms![Order Forms]![Text15].Value = Me.Text15.Value

with a message box
'You can't assign a value to thisobject.


The reason you are getting the message is because a text box
with an expression is calculating its value and it can not
be set any other way (nor can or should it be bound to a
field in a table).

If the text box is supposed to be calculated (per your
concatenation expression), why are you trying to set its
value? The "fix" should be to just remove the code that's
trying to set the value.
 
M

Marshall Barton

I'm sure there is a way to fix things so you can get a
useful result. I'm not at all sure what you asked is a
valid approach.

If you have the values for [First Name] and [Last Name], why
do you want to save the concatenated result in a table. The
table should have [First Name] and [Last Name] fields and
the concatenation of the two should only be displayed for
users' convenience.

With those nondescriptive text box names, I can not even
derive a clue from your posted code. It might(?) be useful
if you explained how the first, last and combined name
values relate to actual fields in both of your tables and
forms.

BTW, your DoCmd.Close line should definitely NOT use
acSaveYes. It saves the form's design, any unsaved data is
automatically saved when the form closes.
--
Marsh
MVP [MS Access]

the purpose i have this is that after i enter data or customer info
from this form he will populate the some info my Order Form

there is no other way to fix this or can you give another to code to work on
this


Marshall Barton said:
Revned said:
i have two different forms, the first one i name it Customer
the second form i name it Order Form....

in my Customer form i have a button [Place Order] with the event
DoCmd.OpenForm "Order Forms", acNormal, , , acFormAdd

Forms![Order Forms]![Text13].Value = Me.Text13.Value
Forms![Order Forms]![Text15].Value = Me.Text15.Value
Forms![Order Forms]![Text19].Value = Me.Text19.Value

Forms![Order Forms]![Combo61].SetFocus

DoCmd.Close acForm, "Customer", acSaveYes

this command will populate the information to my Order Forms such as
customer name [First Name] and [Last Time], the code works will

THE PROBLEM OCCURS when I use concatente in my Order Forms text box
txtCustomerName, i set the control source to = [First Name] & " " & [Last
Name]
it works for some time but when i close the Order Forms
and open my Customer form then click on my cmdPlaceOrder button

i have this Error
'Run Time Error '2448':
and highlights this code
Forms![Order Forms]![Text15].Value = Me.Text15.Value

with a message box
'You can't assign a value to thisobject.


The reason you are getting the message is because a text box
with an expression is calculating its value and it can not
be set any other way (nor can or should it be bound to a
field in a table).

If the text box is supposed to be calculated (per your
concatenation expression), why are you trying to set its
value? The "fix" should be to just remove the code that's
trying to set the value.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top