Re: What have I done???



You probably saved the form while it was open and some of
the settings had been made. This might be a reflex thing to
do if you are modifying some of your code without switching
the form back to design view. However, this problem is only
one of the most minor consequences of modifying a form's
design while in form view. Try to get into the habit of
always switching back to design view before making design or
code changes to a form or report.

If you have some status bar values that you want the same
settings for all the controls, then you may find it more
convenient to use Select Case instead of If, ElseIf. For
example:
Select Case Me.StatusBar
Case 1,2,3,4,5
Me.InvoiceNumber.Enabled = True
. . .
Case 6,7
Me.InvoiceNumber.Enabled = True
Me.InvoiceNumber.Locked = True
. . .
Case 8
Me.InvoiceNumber.Enabled = False
. . .
End Select

I notice that your code is highly repetitive, but not quite
the same actions in all the ElseIf blocks. The fact that
some controls Locked property is not set to either True or
False implies that they will be locked however it was set by
a previous record, surely not a desired effect!? Normally,
you should set both properties in every block.
--
Marsh
MVP [MS Access]


albycindy wrote:

You're probably right! I'm only using an If Then Else code!

Another question, I now have the AfterUpdate and OnCurrent events working
perfectly BUT the current event only fires when I change records in my
subform, not in my main form. That is, when I open the main form, the subform
displays fine, the AfterUpdate event works when I change the Option Group, if
I go to the next subform record and come back to the first one it is still
displaying correctly but if I go to the next main record and come back to the
first one the subform displays normally without the locking/disabling things
I've done. Is there another event that would be better for this? I thought On
Current would be the one that fires last.

Thanks (code below)

If Me.StatusBar.Value = 1 Then
Me.InvoiceNumber.Enabled = True
Me.OrderReference.Enabled = True
Me.Quantity.Enabled = True
Me.Code.Enabled = True
Me.Item.Enabled = True
Me.Problem.Enabled = True
Me.LongCode.Enabled = True
Me.SellPrice.Enabled = True
Me.CostPrice.Enabled = True
Me.Action.Enabled = True
Me.Supplier.Enabled = True
Me.HandlingFee.Enabled = True
Me.HandlingFeeAmount.Enabled = True
Me.ReplacementOrder.Enabled = True
Me.ReplacementReference.Enabled = True
Me.DiscountOffered.Enabled = True
Me.Discount.Enabled = True
Me.DiscountAmount.Enabled = True
Me.SubTotal.Enabled = True
Me.Collect.Enabled = True
Me.cmdReturn.Enabled = True
Me.cmdCollect.Enabled = True
ElseIf Me.StatusBar.Value = 2 Then
Me.InvoiceNumber.Enabled = True
Me.OrderReference.Enabled = True
Me.Quantity.Enabled = True
Me.Code.Enabled = True
Me.Item.Enabled = True
Me.Problem.Enabled = True
Me.LongCode.Enabled = True
Me.SellPrice.Enabled = True
Me.CostPrice.Enabled = True
Me.Action.Enabled = True
Me.Supplier.Enabled = True
Me.HandlingFee.Enabled = True
Me.HandlingFeeAmount.Enabled = True
Me.ReplacementOrder.Enabled = True
Me.ReplacementReference.Enabled = True
Me.DiscountOffered.Enabled = True
Me.Discount.Enabled = True
Me.DiscountAmount.Enabled = True
Me.SubTotal.Enabled = True
Me.Collect.Enabled = True
Me.cmdReturn.Enabled = True
Me.cmdCollect.Enabled = True
ElseIf Me.StatusBar.Value = 3 Then
Me.InvoiceNumber.Enabled = True
Me.OrderReference.Enabled = True
Me.Quantity.Enabled = True
Me.Code.Enabled = True
Me.Item.Enabled = True
Me.Problem.Enabled = True
Me.LongCode.Enabled = True
Me.SellPrice.Enabled = True
Me.CostPrice.Enabled = True
Me.Action.Enabled = True
Me.Supplier.Enabled = True
Me.HandlingFee.Enabled = True
Me.HandlingFeeAmount.Enabled = True
Me.ReplacementOrder.Enabled = True
Me.ReplacementReference.Enabled = True
Me.DiscountOffered.Enabled = True
Me.Discount.Enabled = True
Me.DiscountAmount.Enabled = True
Me.SubTotal.Enabled = True
Me.Collect.Enabled = True
Me.cmdReturn.Enabled = True
Me.cmdCollect.Enabled = True
ElseIf Me.StatusBar.Value = 4 Then
Me.InvoiceNumber.Enabled = True
Me.OrderReference.Enabled = True
Me.Quantity.Enabled = True
Me.Code.Enabled = True
Me.Item.Enabled = True
Me.Problem.Enabled = True
Me.LongCode.Enabled = True
Me.SellPrice.Enabled = True
Me.CostPrice.Enabled = True
Me.Action.Enabled = True
Me.Supplier.Enabled = True
Me.HandlingFee.Enabled = True
Me.HandlingFeeAmount.Enabled = True
Me.ReplacementOrder.Enabled = True
Me.ReplacementReference.Enabled = True
Me.DiscountOffered.Enabled = True
Me.Discount.Enabled = True
Me.DiscountAmount.Enabled = True
Me.SubTotal.Enabled = True
Me.Collect.Enabled = True
Me.cmdReturn.Enabled = True
Me.cmdCollect.Enabled = True
ElseIf Me.StatusBar.Value = 5 Then
Me.InvoiceNumber.Enabled = True
Me.OrderReference.Enabled = True
Me.Quantity.Enabled = True
Me.Code.Enabled = True
Me.Item.Enabled = True
Me.Problem.Enabled = True
Me.LongCode.Enabled = True
Me.SellPrice.Enabled = True
Me.CostPrice.Enabled = True
Me.Action.Enabled = True
Me.Supplier.Enabled = True
Me.HandlingFee.Enabled = True
Me.HandlingFeeAmount.Enabled = True
Me.ReplacementOrder.Enabled = True
Me.ReplacementReference.Enabled = True
Me.DiscountOffered.Enabled = True
Me.Discount.Enabled = True
Me.DiscountAmount.Enabled = True
Me.SubTotal.Enabled = True
Me.Collect.Enabled = True
Me.cmdReturn.Enabled = True
Me.cmdCollect.Enabled = True
ElseIf Me.StatusBar.Value = 6 Then
Me.InvoiceNumber.Enabled = True
Me.InvoiceNumber.Locked = True
Me.OrderReference.Enabled = True
Me.OrderReference.Locked = True
Me.Quantity.Enabled = True
Me.Quantity.Locked = True
Me.Code.Enabled = True
Me.Code.Locked = True
Me.Item.Enabled = True
Me.Item.Locked = True
Me.Problem.Enabled = True
Me.Problem.Locked = True
Me.LongCode.Enabled = True
Me.LongCode.Locked = True
Me.SellPrice.Enabled = True
Me.SellPrice.Locked = True
Me.CostPrice.Enabled = True
Me.CostPrice.Locked = True
Me.Action.Enabled = True
Me.Action.Locked = True
Me.Supplier.Enabled = True
Me.Supplier.Locked = True
Me.HandlingFee.Enabled = True
Me.HandlingFee.Locked = True
Me.HandlingFeeAmount.Enabled = True
Me.HandlingFeeAmount.Locked = True
Me.ReplacementOrder.Enabled = True
Me.ReplacementOrder.Locked = True
Me.ReplacementReference.Enabled = True
Me.ReplacementReference.Locked = True
Me.DiscountOffered.Enabled = True
Me.DiscountOffered.Locked = True
Me.Discount.Enabled = True
Me.Discount.Locked = True
Me.DiscountAmount.Enabled = True
Me.DiscountAmount.Locked = True
Me.SubTotal.Enabled = True
Me.SubTotal.Locked = True
Me.Collect.Enabled = True
Me.Collect.Locked = True
ElseIf Me.StatusBar.Value = 7 Then
Me.InvoiceNumber.Enabled = True
Me.InvoiceNumber.Locked = True
Me.OrderReference.Enabled = True
Me.OrderReference.Locked = True
Me.Quantity.Enabled = True
Me.Quantity.Locked = True
Me.Code.Enabled = True
Me.Code.Locked = True
Me.Item.Enabled = True
Me.Item.Locked = True
Me.Problem.Enabled = True
Me.Problem.Locked = True
Me.LongCode.Enabled = True
Me.LongCode.Locked = True
Me.SellPrice.Enabled = True
Me.SellPrice.Locked = True
Me.CostPrice.Enabled = True
Me.CostPrice.Locked = True
Me.Action.Enabled = True
Me.Action.Locked = True
Me.Supplier.Enabled = True
Me.Supplier.Locked = True
Me.HandlingFee.Enabled = True
Me.HandlingFee.Locked = True
Me.HandlingFeeAmount.Enabled = True
Me.HandlingFeeAmount.Locked = True
Me.ReplacementOrder.Enabled = True
Me.ReplacementOrder.Locked = True
Me.ReplacementReference.Enabled = True
Me.ReplacementReference.Locked = True
Me.DiscountOffered.Enabled = True
Me.DiscountOffered.Locked = True
Me.Discount.Enabled = True
Me.Discount.Locked = True
Me.DiscountAmount.Enabled = True
Me.DiscountAmount.Locked = True
Me.SubTotal.Enabled = True
Me.SubTotal.Locked = True
Me.Collect.Enabled = True
Me.Collect.Locked = True
ElseIf Me.StatusBar.Value = 8 Then
Me.InvoiceNumber.Enabled = False
Me.OrderReference.Enabled = False
Me.Quantity.Enabled = False
Me.Code.Enabled = False
Me.Item.Enabled = False
Me.Problem.Enabled = False
Me.LongCode.Enabled = False
Me.SellPrice.Enabled = False
Me.CostPrice.Enabled = False
Me.Action.Enabled = False
Me.Supplier.Enabled = False
Me.HandlingFee.Enabled = False
Me.HandlingFeeAmount.Enabled = False
Me.ReplacementOrder.Enabled = False
Me.ReplacementReference.Enabled = False
Me.DiscountOffered.Enabled = False
Me.Discount.Enabled = False
Me.DiscountAmount.Enabled = False
Me.SubTotal.Enabled = False
Me.Collect.Enabled = False
Me.cmdReturn.Enabled = False
Me.cmdCollect.Enabled = False
End If



"Jeff Boyce" wrote:

Without some idea of what your code does, I'll opt for "gremlins"... <g>

--
Regards

Jeff Boyce
Microsoft Office/Access MVP
http://mvp.support.microsoft.com/

Microsoft IT Academy Program Mentor
http://microsoftitacademy.com/


"albycindy" <albycindy@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:5F7FC586-8675-455A-984C-5B91BC336FA2@xxxxxxxxxxxxxxxx
Thanks Jeff. That's the answer! Why did they do that though?

"Jeff Boyce" wrote:

Open the form in design mode. Check the form's properties. Pick a
control
you considered "locked/disabled". Check its properties.

--
Regards

Jeff Boyce
Microsoft Office/Access MVP
http://mvp.support.microsoft.com/

Microsoft IT Academy Program Mentor
http://microsoftitacademy.com/


"albycindy" <albycindy@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:8070BA90-D945-404D-B4EC-37B6EF7C34D6@xxxxxxxxxxxxxxxx
I had a few bits of code working nicely behing my subform frmProducts
until I
tried to work with locking/disabling the fields in the form based on
an
Option Group. Well, I finally got that working (the locking/disabling
options) ONCE and now my form has chucked a complete hissyfit!!! It's
always
locked, no matter what option I choose in the Option Group.

So, I removed all the code behind this form, every single bit I could
find
and copied them to a word document but the locking thing is still
happening!
What can I do?





.



Relevant Pages

  • Re: Nested If problem
    ... Microsoft Office/Access MVP ... "Jeff Boyce" wrote: ... and display the second column (the ... ElseIf Me!Downhole_Option Between 2 And 3 Then ...
    (microsoft.public.access.formscoding)
  • Re: What have I done???
    ... That is, when I open the main form, the subform ... ElseIf Me.StatusBar.Value = 2 Then ... "Jeff Boyce" wrote: ... Microsoft Office/Access MVP ...
    (microsoft.public.access.formscoding)
  • Re: Subform OnCurrent Problem
    ... In your AfterUpdate event you used a Select Case statement instead of the If ... in my subform that is working fine, ... ElseIf Me.StatusBar = 6 Then ... Private Sub StatusBar_AfterUpdate ...
    (microsoft.public.access.formscoding)
  • Re: Subform not updating
    ... "PumpTypeCombo" and it is supposed to print a report based on the pump type ... ElseIf Me.PumpTypeCombo = "NIKKISO" Then ... Here's the query for the report also: ... is the JobNumber that is going into your subform. ...
    (microsoft.public.access.forms)
  • Re: Nested If problem
    ... Microsoft Office/Access MVP ... "Jeff Boyce" wrote: ... ElseIf Me!Downhole_Option Between 2 And 3 Then ... of the controls that contribute to the decision. ...
    (microsoft.public.access.formscoding)