The nitrogen in our DNA, the calcium in our teeth, the iron in our blood, the carbon in our apple pies were made in the interiors of collapsing stars. We are made of starstuff.
I'm lost here. I've tried different ways to enable/disable 2 buttons on my form based on if a field is empty or not. I have tried it with Form_Current() and with AfterUpdate() and i keep failing. even used isnull and tried different methods, still nothing. I hope there is anyone who can help me.
the fist button needs to be enabled only when all 4 fields aren't empty
the second button needs to be enabled only when one field is empty and the other is not.
These are the diffrent codes i tried under after update or form current and failed:
---------------------------------------------------------------- Dim lot As Variant Dim prt As Variant Dim qty As Variant Dim ord As Variant
lot = Me.LotNumberField.Value prt = Me.PartNumberField.Value ord = Me.BLOrderNumber.Value qty = Me.PartOrderedQuantity.Value
AddNewPartOrderedButton.Enabled = Not IsEmpty(lot + prt + ord + qty) AddNewLotButton.Enabled = Not IsEmpty(prt) And IsEmpty(lot) ----------------------------------------------------------------
Dim lot As Variant Dim prt As Variant Dim ord As Variant Dim qty As Variant
lot = Me.LotNumberField prt = Me.PartNumberField ord = Me.BLOrderNumber qty = Me.PartOrderedQuantity
If Not IsEmpty(lot) And Not IsEmpty(prt) And Not IsEmpty(ord) And Not IsEmpty(qty) Then Me.AddNewPartOrderedButton.Enabled = True
Else Me.AddNewPartOrderedButton.Enabled = False
End If
If Not IsEmpty(prt) And IsEmpty(lot) Then Me.AddNewLotButton.Enabled = True
Else Me.AddNewLotButton.Enabled = False
End If ----------------------------------------------------------------
Kevin Robertson
@Reply 4 years ago
Does this work for you?
If IsNull(LotNumberField) And IsNull(PartNumberField) And _
IsNull(BLOrderNumber) And IsNull(PartOrderedQuantity) Then
AddNewPartOrderedButton.Enabled = False
Else
AddNewPartOrderedButton.Enabled = True
End If
If Not IsNull(PartNumberField) And IsNull(LotNumberField) Then
AddNewLotButton.Enabled = True
Else
AddNewLotButton.Enabled = False
End If
Sorry, only students may add comments.
Click here for more
information on how you can set up an account.
If you are a Visitor, go ahead and post your reply as a
new comment, and we'll move it here for you
once it's approved. Be sure to use the same name and email address.
This thread is now CLOSED. If you wish to comment, start a NEW discussion in
Visitor Forum.