Sendkeys not working

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

What am I doing wrong??? I am trying to select all the records in a subform
when the user clicks on an option button. Here's my code.

Private Sub frmSelectDeselect_Click()
On Error GoTo Err_Handler

Me.frmPricing_Subform.SetFocus
If frmSelectDeselect = 1 Then 'select all
SendKeys "^{A}^{A}"
End If

Exit_Here:
Exit Sub

Err_Handler:
MsgBox Err.Description
Resume Exit_Here

End Sub
 
Holly,
Avoid using the SendKeys function. It's buggy, and can cause problems
with data enetry from the Num Pad.
Try...
Private Sub frmSelectDeselect_Click()
On Error GoTo Err_Handler
Me.frmPricing_Subform.SetFocus
If frmSelectDeselect = 1 Then 'select all
DoCmd.RunCommand acCmdSelectAllRecords
End If
Exit_Here:
Exit Sub
Err_Handler:
MsgBox Err.Description
Resume Exit_Here
End Sub

In Help, see Run Command and Run Command Constants for a long list of
keystroke type equivalents.
 
Back
Top