RE: Edit Calculated Text Field
- From: Dan <Dan@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Fri, 18 Jan 2008 07:23:02 -0800
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" wrote:
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" wrote:
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" wrote:
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" wrote:
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" wrote:
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" wrote:
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 !!
- Follow-Ups:
- RE: Edit Calculated Text Field
- From: Klatuu
- RE: Edit Calculated Text Field
- References:
- RE: Edit Calculated Text Field
- From: Dan
- RE: Edit Calculated Text Field
- From: Klatuu
- RE: Edit Calculated Text Field
- From: Dan
- RE: Edit Calculated Text Field
- From: Klatuu
- RE: Edit Calculated Text Field
- Prev by Date: Re: Lookup and/or create new record from same box?
- Next by Date: RE: Edit Calculated Text Field
- Previous by thread: RE: Edit Calculated Text Field
- Next by thread: RE: Edit Calculated Text Field
- Index(es):
Relevant Pages
|