M
Mark A. Sam
Hello,
The following code is on the ChangeEvent of a textbox. Line 4 makes a
hidden form, visible, but it also takes the focus off of the textbox being
type into. The textbox is in a subform called [LoadSheetsST]. I tried doing
Screen.PreviousControl.Setfocus from a listbox on the form being
displayed,[LoadSheetsPhoneViewer]. This set the focus to the subform
control, but not the textbox.
I also tried setting a variable, ctl (line 7) to the textbox and setting the
focus that way, but without success.
Thank you for any help
If IsNumeric(Me.ActiveControl.Text) Then
Dim ctl As Control
Set ctl = Me.ActiveControl
Forms![LoadSheetsPhoneViewer].Visible = True
Dim frm As Form
Set frm = Forms![LoadSheetsPhoneViewer]
ctl.SetFocus
frm![Company].RowSource = "SELECT Contacts.PHONE, Contacts.COMPANY,
Contacts.CITY, Contacts.STATE " & _
"FROM Contacts " & _
"GROUP BY Contacts.PHONE, Contacts.COMPANY,
Contacts.CITY, Contacts.STATE " & _
"HAVING Contacts.PHONE Is Not Null And Contacts.PHONE
Like '" & Me.ActiveControl.Text & "*' " & _
"ORDER BY Contacts.PHONE;"
Else
Forms![LoadSheetsPhoneViewer].Visible = False
End If
The following code is on the ChangeEvent of a textbox. Line 4 makes a
hidden form, visible, but it also takes the focus off of the textbox being
type into. The textbox is in a subform called [LoadSheetsST]. I tried doing
Screen.PreviousControl.Setfocus from a listbox on the form being
displayed,[LoadSheetsPhoneViewer]. This set the focus to the subform
control, but not the textbox.
I also tried setting a variable, ctl (line 7) to the textbox and setting the
focus that way, but without success.
Thank you for any help
If IsNumeric(Me.ActiveControl.Text) Then
Dim ctl As Control
Set ctl = Me.ActiveControl
Forms![LoadSheetsPhoneViewer].Visible = True
Dim frm As Form
Set frm = Forms![LoadSheetsPhoneViewer]
ctl.SetFocus
frm![Company].RowSource = "SELECT Contacts.PHONE, Contacts.COMPANY,
Contacts.CITY, Contacts.STATE " & _
"FROM Contacts " & _
"GROUP BY Contacts.PHONE, Contacts.COMPANY,
Contacts.CITY, Contacts.STATE " & _
"HAVING Contacts.PHONE Is Not Null And Contacts.PHONE
Like '" & Me.ActiveControl.Text & "*' " & _
"ORDER BY Contacts.PHONE;"
Else
Forms![LoadSheetsPhoneViewer].Visible = False
End If