M
magmike
I have a button that invokes code onClick and the last line of the
code ask for SetFocus on a control, but for some reason it is not
doing it - sort of. After clicking the button, I cannot find the
cursor anywhere. If I hit the TAB key, nothing happens. So then, if I
click on a blank part of the form (not on a control) then the cursor
shows up in the field that is supposed to get the focus. So it almost
as if the entire form is losing focus. Here is the code:
Private Sub ImportData_Click()
On Error Resume Next
Dim stSpec, stTable, stFileName As String
stSpec = "Prospect Import"
stTable = "Prospects"
stFileName = "C:\Documents and Settings\mkline\Desktop\import.csv"
DoCmd.TransferText acImportDelim, stSpec, stTable, stFileName
DoCmd.Requery
Me.FindCompany.SetFocus
'DoCmd.RunCommand acCmdImport
End Sub
In case it matters, this button is on a subform (Research). The parent
form is Prospects. However, the button and the control that is seeking
the focus are both on the subform.
Does anyone know what is happening here?
Thanks in advance!
magmike
code ask for SetFocus on a control, but for some reason it is not
doing it - sort of. After clicking the button, I cannot find the
cursor anywhere. If I hit the TAB key, nothing happens. So then, if I
click on a blank part of the form (not on a control) then the cursor
shows up in the field that is supposed to get the focus. So it almost
as if the entire form is losing focus. Here is the code:
Private Sub ImportData_Click()
On Error Resume Next
Dim stSpec, stTable, stFileName As String
stSpec = "Prospect Import"
stTable = "Prospects"
stFileName = "C:\Documents and Settings\mkline\Desktop\import.csv"
DoCmd.TransferText acImportDelim, stSpec, stTable, stFileName
DoCmd.Requery
Me.FindCompany.SetFocus
'DoCmd.RunCommand acCmdImport
End Sub
In case it matters, this button is on a subform (Research). The parent
form is Prospects. However, the button and the control that is seeking
the focus are both on the subform.
Does anyone know what is happening here?
Thanks in advance!
magmike