Locking records on sbform (Data View)

Appollo14

New member
Local time
Today, 12:57
Joined
Mar 17, 2001
Messages
5
Hello,
I want to lock selected records on a subform - which is in data view -
at the moment I'am using;

Private Sub Complete_Click()
If [Complete] = True And (IsNull([Forms]![AmendOrders]![OrderItems].[Form]![InvoiceNumber])) And (IsNull([Forms]![AmendOrders]![OrderItems].[Form]![InvoiceDate])) Then
Dim Msg, Style, Title, Help, Ctxt, Response, MyString
Msg = "You Can Not Complete This Order Untill You Have Completed The ITEM INVOICE DATES/NUMBERS! All Changes To This Order Will Be Abandoned."
Style = vbOKOnly + vbWarning + vbDefaultButton1 + vbSystemModal
Title = "You Cant Do That You Muppet!!"
Help = "DEMO.HLP"
Ctxt = 1000
Response = MsgBox(Msg, Style, Title, Help, Ctxt)
If Response = vbOK Then Me.Undo ' User chose Yes.
ElseIf [Complete] = True Then
Dim Msg2, Style2, Title2, Help2, Ctxt2, Response2, MyString2
Msg2 = "If you continue this ordrer Will be Locked. Do you want to continue ?"
Style2 = vbYesNo + vbQuestion + vbDefaultButton2 + vbSystemModal
Title2 = "Set Order To Complete?"
Help2 = "DEMO.HLP"
Ctxt2 = 1000
Response = MsgBox(Msg2, Style2, Title2, Help2, Ctxt2)
If Response = vbYes Then ' User chose Yes.
Forms!AmendOrders.OrderItems.Locked = True
Else
If Response = vbNo Then Me.Undo
End If
End If
End Sub

The problem is that this locks all records and I only want it to lock selected records. The lock will be initiated by the clicking of a "Yes/No" box, which will run a couple of check and if correct criteria me will then lock the record.
I think that I should be applying this event to the CurrentRecord but I'm unsure of how to do this.
Any help greatly appreciated.
Regards,
Noel
 

Users who are viewing this thread

Back
Top Bottom