Edit Calculated Text Field

D

Dan

Hello,

I have a form which includes both customer and delivery address information.
I am wanting the delivery address to prepopulate with the customer's address
except when a valu in an option group is selected.

Currently I have a calculated text field which reads:
=IIf([FRAME51]=1,[Customer_FName],Null)

However, I am wanting to add that if [FRAME51]=2 then the text field may be
able to be typed in manually. Currently the formula I have does not enable
me to do this as the value is set to null.

Please would you let me know if there is another (simple) way to do this? I
am not yet very proficient in VBA so would like to avoid this if possible.

Thanks very much !!
 
K

Klatuu

You cannot edit a value in a control that has an expression or formula in the
control source.

I would suggest using the After Update event of the Option Group control to
populate the fields based on the Option Group selection.

If Me.FRAME51 = 1 Then
Me.txtDeliveryAddress = Me.txtCustomerAddress
Me.txtDeliverAddress.Enabled = False
Me.txtDeliverAddress.Locked = True
Else
Me.txtDeliverAddress.Enabled = True
Me.txtDeliverAddress.Locked = False
End If
 
D

Dan

Thanks Dave,

however when I enter the text below (editing for my specific fields of
course) and try to run the code I get an Open Macro dialogue box opening, and
I am not sure why it does this. Are you able to help? I'm sorry but I am
quite new to VBA.



Klatuu said:
You cannot edit a value in a control that has an expression or formula in the
control source.

I would suggest using the After Update event of the Option Group control to
populate the fields based on the Option Group selection.

If Me.FRAME51 = 1 Then
Me.txtDeliveryAddress = Me.txtCustomerAddress
Me.txtDeliverAddress.Enabled = False
Me.txtDeliverAddress.Locked = True
Else
Me.txtDeliverAddress.Enabled = True
Me.txtDeliverAddress.Locked = False
End If
--
Dave Hargis, Microsoft Access MVP


Dan said:
Hello,

I have a form which includes both customer and delivery address information.
I am wanting the delivery address to prepopulate with the customer's address
except when a valu in an option group is selected.

Currently I have a calculated text field which reads:
=IIf([FRAME51]=1,[Customer_FName],Null)

However, I am wanting to add that if [FRAME51]=2 then the text field may be
able to be typed in manually. Currently the formula I have does not enable
me to do this as the value is set to null.

Please would you let me know if there is another (simple) way to do this? I
am not yet very proficient in VBA so would like to avoid this if possible.

Thanks very much !!
 
K

Klatuu

can you post back the code as you have it. There is nothing in the code I
posted that would cause a macro to run. Do you know how to trace code as it
runs?
--
Dave Hargis, Microsoft Access MVP


Dan said:
Thanks Dave,

however when I enter the text below (editing for my specific fields of
course) and try to run the code I get an Open Macro dialogue box opening, and
I am not sure why it does this. Are you able to help? I'm sorry but I am
quite new to VBA.



Klatuu said:
You cannot edit a value in a control that has an expression or formula in the
control source.

I would suggest using the After Update event of the Option Group control to
populate the fields based on the Option Group selection.

If Me.FRAME51 = 1 Then
Me.txtDeliveryAddress = Me.txtCustomerAddress
Me.txtDeliverAddress.Enabled = False
Me.txtDeliverAddress.Locked = True
Else
Me.txtDeliverAddress.Enabled = True
Me.txtDeliverAddress.Locked = False
End If
--
Dave Hargis, Microsoft Access MVP


Dan said:
Hello,

I have a form which includes both customer and delivery address information.
I am wanting the delivery address to prepopulate with the customer's address
except when a valu in an option group is selected.

Currently I have a calculated text field which reads:
=IIf([FRAME51]=1,[Customer_FName],Null)

However, I am wanting to add that if [FRAME51]=2 then the text field may be
able to be typed in manually. Currently the formula I have does not enable
me to do this as the value is set to null.

Please would you let me know if there is another (simple) way to do this? I
am not yet very proficient in VBA so would like to avoid this if possible.

Thanks very much !!
 
D

Dan

Thanks Dave, the code is:

Private Sub Frame51_AfterUpdate()

If Frame51 = 1 Then
Salutation = Deliver_Salutation
Deliver_Salutation.Enabled = False
Deliver_Salutation.Locked = True
Else
Deliver_Salutation.Enabled = True
Deliver_Salutation.Locked = False

End If

End Sub



Klatuu said:
can you post back the code as you have it. There is nothing in the code I
posted that would cause a macro to run. Do you know how to trace code as it
runs?
--
Dave Hargis, Microsoft Access MVP


Dan said:
Thanks Dave,

however when I enter the text below (editing for my specific fields of
course) and try to run the code I get an Open Macro dialogue box opening, and
I am not sure why it does this. Are you able to help? I'm sorry but I am
quite new to VBA.



Klatuu said:
You cannot edit a value in a control that has an expression or formula in the
control source.

I would suggest using the After Update event of the Option Group control to
populate the fields based on the Option Group selection.

If Me.FRAME51 = 1 Then
Me.txtDeliveryAddress = Me.txtCustomerAddress
Me.txtDeliverAddress.Enabled = False
Me.txtDeliverAddress.Locked = True
Else
Me.txtDeliverAddress.Enabled = True
Me.txtDeliverAddress.Locked = False
End If
--
Dave Hargis, Microsoft Access MVP


:

Hello,

I have a form which includes both customer and delivery address information.
I am wanting the delivery address to prepopulate with the customer's address
except when a valu in an option group is selected.

Currently I have a calculated text field which reads:
=IIf([FRAME51]=1,[Customer_FName],Null)

However, I am wanting to add that if [FRAME51]=2 then the text field may be
able to be typed in manually. Currently the formula I have does not enable
me to do this as the value is set to null.

Please would you let me know if there is another (simple) way to do this? I
am not yet very proficient in VBA so would like to avoid this if possible.

Thanks very much !!
 
K

Klatuu

First, you need to reference your controls to the form. What is salutation?

Private Sub Frame51_AfterUpdate()

If Frame51 = 1 Then
Salutation = Me.Deliver_Salutation
Me.Deliver_Salutation.Enabled = False
Me.Deliver_Salutation.Locked = True
Else
Me.Deliver_Salutation.Enabled = True
Me.Deliver_Salutation.Locked = False

End If

End Sub

See if that helps.
--
Dave Hargis, Microsoft Access MVP


Dan said:
Thanks Dave, the code is:

Private Sub Frame51_AfterUpdate()

If Frame51 = 1 Then
Salutation = Deliver_Salutation
Deliver_Salutation.Enabled = False
Deliver_Salutation.Locked = True
Else
Deliver_Salutation.Enabled = True
Deliver_Salutation.Locked = False

End If

End Sub



Klatuu said:
can you post back the code as you have it. There is nothing in the code I
posted that would cause a macro to run. Do you know how to trace code as it
runs?
--
Dave Hargis, Microsoft Access MVP


Dan said:
Thanks Dave,

however when I enter the text below (editing for my specific fields of
course) and try to run the code I get an Open Macro dialogue box opening, and
I am not sure why it does this. Are you able to help? I'm sorry but I am
quite new to VBA.



:

You cannot edit a value in a control that has an expression or formula in the
control source.

I would suggest using the After Update event of the Option Group control to
populate the fields based on the Option Group selection.

If Me.FRAME51 = 1 Then
Me.txtDeliveryAddress = Me.txtCustomerAddress
Me.txtDeliverAddress.Enabled = False
Me.txtDeliverAddress.Locked = True
Else
Me.txtDeliverAddress.Enabled = True
Me.txtDeliverAddress.Locked = False
End If
--
Dave Hargis, Microsoft Access MVP


:

Hello,

I have a form which includes both customer and delivery address information.
I am wanting the delivery address to prepopulate with the customer's address
except when a valu in an option group is selected.

Currently I have a calculated text field which reads:
=IIf([FRAME51]=1,[Customer_FName],Null)

However, I am wanting to add that if [FRAME51]=2 then the text field may be
able to be typed in manually. Currently the formula I have does not enable
me to do this as the value is set to null.

Please would you let me know if there is another (simple) way to do this? I
am not yet very proficient in VBA so would like to avoid this if possible.

Thanks very much !!
 
D

Dan

Hi Dave,

Salutation and Deliver_Salutation are two fields within a form.

If the option group Frame51=1 then I want whatever is within the Salutation
field to be replicated in the Deliver_Salutation field. If the option group
Frame51=2 then I want the user to be able to type into the Deliver_Salutation
field.

The Salutation field is a text box within the form.

If I enter the code you have given me within Microsoft Visual Basic as an
Event Procedure (After Update) for Frame51 then I am still receiving the Open
Macro dialogue box.

Thanks again,

Dan


Klatuu said:
First, you need to reference your controls to the form. What is salutation?

Private Sub Frame51_AfterUpdate()

If Frame51 = 1 Then
Salutation = Me.Deliver_Salutation
Me.Deliver_Salutation.Enabled = False
Me.Deliver_Salutation.Locked = True
Else
Me.Deliver_Salutation.Enabled = True
Me.Deliver_Salutation.Locked = False

End If

End Sub

See if that helps.
--
Dave Hargis, Microsoft Access MVP


Dan said:
Thanks Dave, the code is:

Private Sub Frame51_AfterUpdate()

If Frame51 = 1 Then
Salutation = Deliver_Salutation
Deliver_Salutation.Enabled = False
Deliver_Salutation.Locked = True
Else
Deliver_Salutation.Enabled = True
Deliver_Salutation.Locked = False

End If

End Sub



Klatuu said:
can you post back the code as you have it. There is nothing in the code I
posted that would cause a macro to run. Do you know how to trace code as it
runs?
--
Dave Hargis, Microsoft Access MVP


:


Thanks Dave,

however when I enter the text below (editing for my specific fields of
course) and try to run the code I get an Open Macro dialogue box opening, and
I am not sure why it does this. Are you able to help? I'm sorry but I am
quite new to VBA.



:

You cannot edit a value in a control that has an expression or formula in the
control source.

I would suggest using the After Update event of the Option Group control to
populate the fields based on the Option Group selection.

If Me.FRAME51 = 1 Then
Me.txtDeliveryAddress = Me.txtCustomerAddress
Me.txtDeliverAddress.Enabled = False
Me.txtDeliverAddress.Locked = True
Else
Me.txtDeliverAddress.Enabled = True
Me.txtDeliverAddress.Locked = False
End If
--
Dave Hargis, Microsoft Access MVP


:

Hello,

I have a form which includes both customer and delivery address information.
I am wanting the delivery address to prepopulate with the customer's address
except when a valu in an option group is selected.

Currently I have a calculated text field which reads:
=IIf([FRAME51]=1,[Customer_FName],Null)

However, I am wanting to add that if [FRAME51]=2 then the text field may be
able to be typed in manually. Currently the formula I have does not enable
me to do this as the value is set to null.

Please would you let me know if there is another (simple) way to do this? I
am not yet very proficient in VBA so would like to avoid this if possible.

Thanks very much !!
 
K

Klatuu

Okay then where you have salutation, it should be Me.salutation.

Where did you put the code? If you put it directly into the After Update
event window in the properties dialog for the option group, that may be the
problem.
What you should do is clear the box out. Then click on the small command
button next to the After Update event text box and select Code Builder from
the dialog that will popu up. Then the VBA editor will open positioned in
the event procedure. Paste the code there.

Let me know if that does not cure it.
--
Dave Hargis, Microsoft Access MVP


Dan said:
Hi Dave,

Salutation and Deliver_Salutation are two fields within a form.

If the option group Frame51=1 then I want whatever is within the Salutation
field to be replicated in the Deliver_Salutation field. If the option group
Frame51=2 then I want the user to be able to type into the Deliver_Salutation
field.

The Salutation field is a text box within the form.

If I enter the code you have given me within Microsoft Visual Basic as an
Event Procedure (After Update) for Frame51 then I am still receiving the Open
Macro dialogue box.

Thanks again,

Dan


Klatuu said:
First, you need to reference your controls to the form. What is salutation?

Private Sub Frame51_AfterUpdate()

If Frame51 = 1 Then
Salutation = Me.Deliver_Salutation
Me.Deliver_Salutation.Enabled = False
Me.Deliver_Salutation.Locked = True
Else
Me.Deliver_Salutation.Enabled = True
Me.Deliver_Salutation.Locked = False

End If

End Sub

See if that helps.
--
Dave Hargis, Microsoft Access MVP


Dan said:
Thanks Dave, the code is:

Private Sub Frame51_AfterUpdate()

If Frame51 = 1 Then
Salutation = Deliver_Salutation
Deliver_Salutation.Enabled = False
Deliver_Salutation.Locked = True
Else
Deliver_Salutation.Enabled = True
Deliver_Salutation.Locked = False

End If

End Sub



:

can you post back the code as you have it. There is nothing in the code I
posted that would cause a macro to run. Do you know how to trace code as it
runs?
--
Dave Hargis, Microsoft Access MVP


:


Thanks Dave,

however when I enter the text below (editing for my specific fields of
course) and try to run the code I get an Open Macro dialogue box opening, and
I am not sure why it does this. Are you able to help? I'm sorry but I am
quite new to VBA.



:

You cannot edit a value in a control that has an expression or formula in the
control source.

I would suggest using the After Update event of the Option Group control to
populate the fields based on the Option Group selection.

If Me.FRAME51 = 1 Then
Me.txtDeliveryAddress = Me.txtCustomerAddress
Me.txtDeliverAddress.Enabled = False
Me.txtDeliverAddress.Locked = True
Else
Me.txtDeliverAddress.Enabled = True
Me.txtDeliverAddress.Locked = False
End If
--
Dave Hargis, Microsoft Access MVP


:

Hello,

I have a form which includes both customer and delivery address information.
I am wanting the delivery address to prepopulate with the customer's address
except when a valu in an option group is selected.

Currently I have a calculated text field which reads:
=IIf([FRAME51]=1,[Customer_FName],Null)

However, I am wanting to add that if [FRAME51]=2 then the text field may be
able to be typed in manually. Currently the formula I have does not enable
me to do this as the value is set to null.

Please would you let me know if there is another (simple) way to do this? I
am not yet very proficient in VBA so would like to avoid this if possible.

Thanks very much !!
 
D

Dan

thanks so much Dave, it all seems to be working correctly now !!


Klatuu said:
Okay then where you have salutation, it should be Me.salutation.

Where did you put the code? If you put it directly into the After Update
event window in the properties dialog for the option group, that may be the
problem.
What you should do is clear the box out. Then click on the small command
button next to the After Update event text box and select Code Builder from
the dialog that will popu up. Then the VBA editor will open positioned in
the event procedure. Paste the code there.

Let me know if that does not cure it.
--
Dave Hargis, Microsoft Access MVP


Dan said:
Hi Dave,

Salutation and Deliver_Salutation are two fields within a form.

If the option group Frame51=1 then I want whatever is within the Salutation
field to be replicated in the Deliver_Salutation field. If the option group
Frame51=2 then I want the user to be able to type into the Deliver_Salutation
field.

The Salutation field is a text box within the form.

If I enter the code you have given me within Microsoft Visual Basic as an
Event Procedure (After Update) for Frame51 then I am still receiving the Open
Macro dialogue box.

Thanks again,

Dan


Klatuu said:
First, you need to reference your controls to the form. What is salutation?

Private Sub Frame51_AfterUpdate()

If Frame51 = 1 Then
Salutation = Me.Deliver_Salutation
Me.Deliver_Salutation.Enabled = False
Me.Deliver_Salutation.Locked = True
Else
Me.Deliver_Salutation.Enabled = True
Me.Deliver_Salutation.Locked = False

End If

End Sub

See if that helps.
--
Dave Hargis, Microsoft Access MVP


:

Thanks Dave, the code is:

Private Sub Frame51_AfterUpdate()

If Frame51 = 1 Then
Salutation = Deliver_Salutation
Deliver_Salutation.Enabled = False
Deliver_Salutation.Locked = True
Else
Deliver_Salutation.Enabled = True
Deliver_Salutation.Locked = False

End If

End Sub



:

can you post back the code as you have it. There is nothing in the code I
posted that would cause a macro to run. Do you know how to trace code as it
runs?
--
Dave Hargis, Microsoft Access MVP


:


Thanks Dave,

however when I enter the text below (editing for my specific fields of
course) and try to run the code I get an Open Macro dialogue box opening, and
I am not sure why it does this. Are you able to help? I'm sorry but I am
quite new to VBA.



:

You cannot edit a value in a control that has an expression or formula in the
control source.

I would suggest using the After Update event of the Option Group control to
populate the fields based on the Option Group selection.

If Me.FRAME51 = 1 Then
Me.txtDeliveryAddress = Me.txtCustomerAddress
Me.txtDeliverAddress.Enabled = False
Me.txtDeliverAddress.Locked = True
Else
Me.txtDeliverAddress.Enabled = True
Me.txtDeliverAddress.Locked = False
End If
--
Dave Hargis, Microsoft Access MVP


:

Hello,

I have a form which includes both customer and delivery address information.
I am wanting the delivery address to prepopulate with the customer's address
except when a valu in an option group is selected.

Currently I have a calculated text field which reads:
=IIf([FRAME51]=1,[Customer_FName],Null)

However, I am wanting to add that if [FRAME51]=2 then the text field may be
able to be typed in manually. Currently the formula I have does not enable
me to do this as the value is set to null.

Please would you let me know if there is another (simple) way to do this? I
am not yet very proficient in VBA so would like to avoid this if possible.

Thanks very much !!
 
K

Klatuu

Glad I could help, Dan.
--
Dave Hargis, Microsoft Access MVP


Dan said:
thanks so much Dave, it all seems to be working correctly now !!


Klatuu said:
Okay then where you have salutation, it should be Me.salutation.

Where did you put the code? If you put it directly into the After Update
event window in the properties dialog for the option group, that may be the
problem.
What you should do is clear the box out. Then click on the small command
button next to the After Update event text box and select Code Builder from
the dialog that will popu up. Then the VBA editor will open positioned in
the event procedure. Paste the code there.

Let me know if that does not cure it.
--
Dave Hargis, Microsoft Access MVP


Dan said:
Hi Dave,

Salutation and Deliver_Salutation are two fields within a form.

If the option group Frame51=1 then I want whatever is within the Salutation
field to be replicated in the Deliver_Salutation field. If the option group
Frame51=2 then I want the user to be able to type into the Deliver_Salutation
field.

The Salutation field is a text box within the form.

If I enter the code you have given me within Microsoft Visual Basic as an
Event Procedure (After Update) for Frame51 then I am still receiving the Open
Macro dialogue box.

Thanks again,

Dan


:

First, you need to reference your controls to the form. What is salutation?

Private Sub Frame51_AfterUpdate()

If Frame51 = 1 Then
Salutation = Me.Deliver_Salutation
Me.Deliver_Salutation.Enabled = False
Me.Deliver_Salutation.Locked = True
Else
Me.Deliver_Salutation.Enabled = True
Me.Deliver_Salutation.Locked = False

End If

End Sub

See if that helps.
--
Dave Hargis, Microsoft Access MVP


:

Thanks Dave, the code is:

Private Sub Frame51_AfterUpdate()

If Frame51 = 1 Then
Salutation = Deliver_Salutation
Deliver_Salutation.Enabled = False
Deliver_Salutation.Locked = True
Else
Deliver_Salutation.Enabled = True
Deliver_Salutation.Locked = False

End If

End Sub



:

can you post back the code as you have it. There is nothing in the code I
posted that would cause a macro to run. Do you know how to trace code as it
runs?
--
Dave Hargis, Microsoft Access MVP


:


Thanks Dave,

however when I enter the text below (editing for my specific fields of
course) and try to run the code I get an Open Macro dialogue box opening, and
I am not sure why it does this. Are you able to help? I'm sorry but I am
quite new to VBA.



:

You cannot edit a value in a control that has an expression or formula in the
control source.

I would suggest using the After Update event of the Option Group control to
populate the fields based on the Option Group selection.

If Me.FRAME51 = 1 Then
Me.txtDeliveryAddress = Me.txtCustomerAddress
Me.txtDeliverAddress.Enabled = False
Me.txtDeliverAddress.Locked = True
Else
Me.txtDeliverAddress.Enabled = True
Me.txtDeliverAddress.Locked = False
End If
--
Dave Hargis, Microsoft Access MVP


:

Hello,

I have a form which includes both customer and delivery address information.
I am wanting the delivery address to prepopulate with the customer's address
except when a valu in an option group is selected.

Currently I have a calculated text field which reads:
=IIf([FRAME51]=1,[Customer_FName],Null)

However, I am wanting to add that if [FRAME51]=2 then the text field may be
able to be typed in manually. Currently the formula I have does not enable
me to do this as the value is set to null.

Please would you let me know if there is another (simple) way to do this? I
am not yet very proficient in VBA so would like to avoid this if possible.

Thanks very much !!
 

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