Hello,
I have a button on the main form and the follwing code when you click on it. Though the last record is the sub form (datasheet view) is shown, the focus remains on the button last_transactio n on the main form. I tried to get the focus on the sub form
but i get an error 'the expression contains an invalid methode'. When I search for a solution everyone states that the above statement should work. But the focus remains on the button on the main form. What's wrong?
Thanks in advance
kind regards,
gerhard
I have a button on the main form and the follwing code when you click on it. Though the last record is the sub form (datasheet view) is shown, the focus remains on the button last_transactio n on the main form. I tried to get the focus on the sub form
Code:
form_transaction.setfocus
Thanks in advance
kind regards,
gerhard
Code:
Private Sub last_Transaction_Click()
'On Error GoTo Err_last_Transaction_Click
Dim frm As Form
Form_transaction.OrderBy = "transaction_number,transaction_date"
Form_transaction.OrderByOn = True
'Set reference to "subform"
Set frm = Form_transaction.Form
'Goto last record in subform
If frm.RecordsetClone.RecordCount > 0 Then
frm.SelTop = frm.RecordsetClone.RecordCount
End If
Exit_last_Transaction_Click:
Exit Sub
Err_last_Transaction_Click:
MsgBox Err.Description
Resume Exit_last_Transaction_Click
End Sub
Comment