Hi, I have been trying to create a dummy button in a continuous subform. I want to press the button and the FertRecStatus to change from yes to no and then back again. I need to requery the subform to change some formatting but I want the focus to stay with the line I originally clicked.
Below is my code which I have cobbled together and not yet tested but I am getting a "Block If without End If" error message and to be honest now can't see the wood from the trees.
Can anyone help point me in the right direction?
Thanks as always
Below is my code which I have cobbled together and not yet tested but I am getting a "Block If without End If" error message and to be honest now can't see the wood from the trees.
Can anyone help point me in the right direction?
Code:
Private Sub CmdFertRecStatus_Click()
Dim lngKeyVal As Long
' This code saves the CroppingNumber value of the Subform
lngKeyVal = Me.CroppingNumber
If Me.FertRecStatus = True Then
Me.FertRecStatus = False
Me.Requery
' This moves back to the original record
With Me.RecordsetClone
.FindFirst "[CroppingNumber] = " & lngKeyVal
If Not .NoMatch Then
Me.Bookmark = .Bookmark
ElseIf Me.FertRecStatus = False Then
Me.FertRecStatus = True
Me.Requery
' This moves back to the original record
With Me.RecordsetClone
.FindFirst "[CroppingNumber] = " & lngKeyVal
If Not .NoMatch Then
Me.Bookmark = .Bookmark
End If
End With
End Sub
Thanks as always