Refresh control on form

B

BudAtLitho

Hello:

I have a form that searches a table alphabetically, using the first
letter as a filter. When I open the form and enter the search
character, all's well - the combo box displays only those records that
start with the entered character. However, I cannot get the combo box
control to refresh the search value when it is changed.
Here's the SQL:
SELECT [Roster].[EMP_ID], [Roster].[LAST_NM], [Roster].[FIRST_NM] FROM
Roster WHERE Left([LAST_NM],1)=[SearchBy] ORDER BY [Roster].
[LAST_NM];

SearchBy is a text box on the same form.

I've tried the following in OnClick, OnFocus, etc., and can't get it
to refresh:

Private Sub Combo31_GotFocus()

Forms!Attendees.SearchBy.Requery


End Sub

What am I missing?

TIA

Bud
 
D

Douglas J. Steele

That SQL needs to be

SELECT [Roster].[EMP_ID], [Roster].[LAST_NM], [Roster].[FIRST_NM]
FROM Roster
WHERE Left([LAST_NM],1)=Forms![NameOfForm]![SearchBy]
ORDER BY [Roster].[LAST_NM];

Assuming it's the RowSource for Combo31, you'd use

Private Sub Combo31_GotFocus()

Me.Combo31.Requery

End Sub
 
B

BudAtLitho

Doug:

THANKS for the quick reply - of course, your code works! I haven't
delved into VBA far enough to get to "me" and when it's used, but with
your direction I will now.

Bud :))


That SQL needs to be

SELECT [Roster].[EMP_ID], [Roster].[LAST_NM], [Roster].[FIRST_NM]
FROM Roster
WHERE Left([LAST_NM],1)=Forms![NameOfForm]![SearchBy]
ORDER BY [Roster].[LAST_NM];

Assuming it's the RowSource for Combo31, you'd use

Private Sub Combo31_GotFocus()

� Me.Combo31.Requery

End Sub

--
Doug Steele, Microsoft Access MVPhttp://I.Am/DougSteele
(no e-mails, please!)




I have a form that searches a table alphabetically, using the first
letter as a filter. �When I open the form and enter the search
character, all's well - the combo box displays only those records that
start with the entered character. �However, I cannot get the combo box
control to refresh the search value when it is changed.
Here's the SQL:
SELECT [Roster].[EMP_ID], [Roster].[LAST_NM], [Roster].[FIRST_NM] FROM
Roster WHERE Left([LAST_NM],1)=[SearchBy] ORDER BY [Roster].
[LAST_NM];
SearchBy is a text box on the same form.
I've tried the following in OnClick, OnFocus, etc., and can't get it
to refresh:
Private Sub Combo31_GotFocus()
� �Forms!Attendees.SearchBy.Requery
What am I missing?

Bud- Hide quoted text -

- Show quoted text -
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top