edit button for tabular view

chinkygogo

New member
Local time
Today, 13:41
Joined
Aug 21, 2006
Messages
7
hi there,

i have a form (to be used as a subform). I have added a button to the form so that records can be edited. attached to this button i have written a macro to unlock the text boxes (when pressed). Please find diagram attached. My problem is that the button unlocks all boxes in all records to be edited rather than the record associated with the button pressed. Here is the macro i have written:

Private Sub btEdit_Click()

UPN.Locked = False
Personnel_Number.Locked = False
Subject.Locked = False

End Sub

Thank you in advance
 

Attachments

  • tabular view.JPG
    tabular view.JPG
    25.2 KB · Views: 153
On the forms Close event and On Current event, you need to Lock the fields.

Just as a precaution, you could also set the field's Locked Propety to False. Obviously you will need to Un-lock them for a New Record. This can be achieved by having a menu or button command that is Add New Record. This would give a PUBLIC flag variable the value "New" and in the On Current code, use the code

If varNew = "New" then
... unlock
varNew = "" ' this resets the variable
else
... Lock
end if

I would also reset the varNew to "" on the forms Close event - just belt and braces.
 

Users who are viewing this thread

Back
Top Bottom