Yeh ageeI would have thought adding some Me. would help, and that can be simplified to
Me.Mass.Enabled = Me.MassRequired
Private Sub Form_Current()
If MassRequired = True Then
Me.Mass.Enabled = True
Else
Me.Mass.Enabled = False
End If
End Sub
Although using Me is often very helpful in clarifying your code and bringing up intellisense, in truth it is rarely required in a form/report module.I would have thought adding some Me. would help, and that can be simplified to
Me.Mass.Enabled = Me.MassRequired
Private Sub Form_Current()
EnableDisableMass
End Sub
Private Sub EnableDisableMass()
Me.Mass.Enabled = Me.MassRequired
Me.Mass.TabStop = Me.MassRequired
End Sub
Private Sub MassRequired_AfterUpdate()
EnableDisableMass
End Sub
Oh yeah, I forgot that enabling can be done using conditional formatting too. However, the demo also demonstrates disabling/enabling the tab stop.Can use Conditional Formatting to enable/disable textbox or combobox.
Hi,Although using Me is often very helpful in clarifying your code and bringing up intellisense, in truth it is rarely required in a form/report module.
Any property of a form is accessible without the Me keyword so you can simply write the control name or field name or other property.
Mass.enabled is the same as Me.Mass.enabled
Same principle as Application
I never seen anyone write
Application.Docmd
But that is the full qualifier
@Gismo,
Also I am guessing you also need to put the code in the after update of the MassRequired
Code:Private Sub Form_Current() EnableDisableMass End Sub Private Sub EnableDisableMass() Me.Mass.Enabled = Me.MassRequired Me.Mass.TabStop = Me.MassRequired End Sub Private Sub MassRequired_AfterUpdate() EnableDisableMass End Sub
Works perfectly fine for me.
I think you forgot to post it.Hi,
Please see my DB
Now attachedI think you forgot to post it.
Hi,Untested
Code:iif([currencyField] = "UGX", nz([mass],1) * nz([quantity],1) *[UnitPrice], nz([mass],1) * nz([quantity],1) *[UnitPrice] * [Exchange])
Nz([Mass],1) returns 1 if null else the value for mass
Hi,Although using Me is often very helpful in clarifying your code and bringing up intellisense, in truth it is rarely required in a form/report module.
Any property of a form is accessible without the Me keyword so you can simply write the control name or field name or other property.
Mass.enabled is the same as Me.Mass.enabled
Same principle as Application
I never seen anyone write
Application.Docmd
But that is the full qualifier
@Gismo,
Also I am guessing you also need to put the code in the after update of the MassRequired
Code:Private Sub Form_Current() EnableDisableMass End Sub Private Sub EnableDisableMass() Me.Mass.Enabled = Me.MassRequired Me.Mass.TabStop = Me.MassRequired End Sub Private Sub MassRequired_AfterUpdate() EnableDisableMass End Sub
Works perfectly fine for me.
Hi,Now attached
Private Sub Product_AfterUpdate()
DoCmd.SetWarnings False
DoCmd.RunCommand acCmdSaveRecord
DoCmd.OpenQuery "Update Transaction - Procurement - Temp - Currency"
DoCmd.OpenQuery "Update Transaction - Procurement - Temp - UOM"
DoCmd.GoToControl "Qty"
Qty.Requery
DoCmd.SetWarnings True
Dim value As Currency
If Not IsDate(Me.[Transaction Date]) Then
MsgBox "Please enter a valid date!"
Exit Sub
End If
Call fncUpdateFields
End Sub
Private Sub EnableDisableMass()
Me.Mass.Enabled = Me.MassRequired
Me.Mass.TabStop = Me.MassRequired
End Sub
Private Sub Product_AfterUpdate()
DoCmd.SetWarnings False
EnableDisableMass
DoCmd.RunCommand acCmdSaveRecord
DoCmd.OpenQuery "Update Transaction - Procurement - Temp - Currency"
DoCmd.OpenQuery "Update Transaction - Procurement - Temp - UOM"
Me.Mass.Enabled = Me.MassRequired
Me.Mass.TabStop = Me.MassRequired
EnableDisableMass
DoCmd.GoToControl "Qty"
Qty.Requery
DoCmd.SetWarnings True
Dim value As Currency
If Not IsDate(Me.[Transaction Date]) Then
MsgBox "Please enter a valid date!"
Exit Sub
End If
Call fncUpdateFields
End Sub