enable/disable a row

E

EddWood

I have an invoice form that I can select items in the sub form to dispatch.
I want the next time the form is opened the items that have been marked as
shipped I want then to be disabled, so they can be seen but not edited, I
think my code should be something like:

Private Sub Form_Load()
if me.check85 = 0 then
(this row ) enabled = false
end if
End Sub

I just don't know how I structure the code if anyone can suggest?
 
L

Linq Adams via AccessMonster.com

You cannot "disable" a row, only controls on the record for that row. You can,
however, disallow editing, which is what you need to do here. Also, anything
like this done in the Form_Load event will only affect the first record
displayed! For it to be applied to every record, it needs to be placed in the
Form_Current event.

Assuming that

check85

is ticked to indicate the item has been shipped, then

Private Sub Form_Current()
If Me.check85 = -1 Then
Me.AllowEdits = False
Else
Me.AllowEdits = True
End If
End Sub

As when using any code of this nature, you need to have a plan for dealing
with mistakes when they occur, and trust me, someone will tick the checkbox
to indicate an item has been shipped only to find that it hasn't.
 
E

EddWood

Many thanks for that, and it works fine, thank you. Do you know if I can set
the 'row' to show as not-enabled or set a condition to the full row so it is
highlighted in say, red etc?
 
E

EddWood

Its ok I have sorted it thanks

EddWood said:
Many thanks for that, and it works fine, thank you. Do you know if I can
set the 'row' to show as not-enabled or set a condition to the full row so
it is highlighted in say, red etc?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top