Hello,
I am working with an AfterUpdate check box.
What am I am attempting to do is just before the highlighted red text is ask the user, do you wish to make the changes. I have a main form that feeds into a subform. The upper part of the subform is a continuous form while the form footer is where I am looping the record.
If the user selects yes on the message box, proceed with the highlighted red text below and loop that subform record, without asking again for the record. (Example, if the subform had three records, it would change all three after selecting yes rather than asking each individually).
If no, do nothing.
I was using the blue text below but it kept highlighting rst.edit and wouldn't loop.
I am working with an AfterUpdate check box.
What am I am attempting to do is just before the highlighted red text is ask the user, do you wish to make the changes. I have a main form that feeds into a subform. The upper part of the subform is a continuous form while the form footer is where I am looping the record.
If the user selects yes on the message box, proceed with the highlighted red text below and loop that subform record, without asking again for the record. (Example, if the subform had three records, it would change all three after selecting yes rather than asking each individually).
If no, do nothing.
I was using the blue text below but it kept highlighting rst.edit and wouldn't loop.
Code:
Private Sub Ctl216_AfterUpdate()
Dim dbs As Database, rst As DAO.Recordset
Set dbs = CurrentDb
Set rst = dbs.OpenRecordset("SELECT * FROM tblPropertyDetails WHERE DetentionID=" & Key, dbOpenDynaset)
If Not rst.EOF Then
If Me![216] = -1 Then
Me![216_Number] = Forms![216]![216_Number]
Me![Left] = Forms![216]![Transfer to]
Me![Date Out] = date
Me![Time Out] = time()
Do
If IsNull(rst![BagNum]) Then
Exit Do
Else
[COLOR=red]rst.Edit[/COLOR]
[COLOR=red] rst![PropertyStatus] = 3[/COLOR]
[COLOR=red] rst![DateOut] = date[/COLOR]
[COLOR=red] rst.Update[/COLOR]
End If
rst.MoveNext
Loop Until rst.EOF
Else
If Me![216] = 0 Then
Me![216_Number] = ""
Me![Left] = ""
Me![Date Out] = ""
Me![Time Out] = ""
Do
If IsNull(rst![BagNum]) Then
Exit Do
Else
rst.Edit
rst![PropertyStatus] = 2
rst![DateOut] = Null
rst.Update
End If
rst.MoveNext
Loop Until rst.EOF
End If
End If
Me.Refresh
End If
End Sub
Code:
[COLOR=blue]LResponse = MsgBox("Do you wish to 216 property?", vbYesNo, "Property Information")[/COLOR]
[COLOR=blue]If LResponse = vbYes Then[/COLOR]
[COLOR=blue] {...red text statements from above...}[/COLOR]
[COLOR=blue]Else[/COLOR]
[COLOR=blue] {...do nothing...}[/COLOR]