RE: Edit Calculated Text Field




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 !!

.



Relevant Pages

  • RE: Edit Calculated Text Field
    ... Okay then where you have salutation, ... Dave Hargis, Microsoft Access MVP ... If the option group Frame51=1 then I want whatever is within the Salutation ... Private Sub Frame51_AfterUpdate ...
    (microsoft.public.access.forms)
  • Re: Increase max Options in an Option Group
    ... > The Corp Tech Demos has a Customer Menu form with all customers in alpha ... There is a tall command ... > Private Sub cmdIndex_MouseMove(_ ... >> The Option Group Wizard is limiting me to 20 options, ...
    (microsoft.public.access.forms)
  • RE: Show / Hide Fields from a Check Box
    ... this but I must have accidently deleted the control source of my check-box. ... Private Sub ChckSelfQa1_AfterUpdate ... then I want my option group to show otherwise it shouldn't be visible. ... visibliity for the current record as well as for new records: ...
    (microsoft.public.access.formscoding)
  • RE: Show / Hide Fields from a Check Box
    ... Dave Hargis, Microsoft Access MVP ... Private Sub ChckSelfQa1_AfterUpdate ... then I want my option group to show otherwise it shouldn't be visible. ...
    (microsoft.public.access.formscoding)
  • Re: Is Not Null
    ... your initial post left off any mention of the option group and the ... Private Sub Command13_Click ... MsgBox Err.Description ... reports based on the value of what i assume is an option group control, ...
    (microsoft.public.access.forms)