I have a form based on a table which stores peoples contact information. On this form I have a listbox that is based on a query. That query is setup to show anyone who has a postcode 'Like' what is in the current records 'Postcode' field.
What I want to happen is as the user is typing a postcode into the 'Postcode' field on the form, the listbox requeries itself after each character is entered, therefore reducing the number of results in the listbox.
I have tried using the following VBA code in the 'After Update', 'On Change' & 'On Key Up' events but none of them seem to requery the listbox unless I leave the 'Postcode' field. I want it to do it each time after I've entered a character.
Private Sub Postcode_Change()
Me.List233.Requery
End Sub
This is the SQL code from my query:
SELECT [Main Contact Data].ID AS [Customer Number], [Title] & " " & [Firstname] & " " & [Surname] AS Name, [Main Contact Data].Postcode
FROM [Main Contact Data]
WHERE ((([Main Contact Data].Postcode) Like [Forms]![AlexLightDatabaseNEW]![Postcode] & "*"))
ORDER BY [Main Contact Data].Postcode;
The whole idea of this is to try and stop the users from entering the same person twice into the database without having to do a tedious search each time they enter somebody.
Any suggestions would be appreciated. Thanks.
What I want to happen is as the user is typing a postcode into the 'Postcode' field on the form, the listbox requeries itself after each character is entered, therefore reducing the number of results in the listbox.
I have tried using the following VBA code in the 'After Update', 'On Change' & 'On Key Up' events but none of them seem to requery the listbox unless I leave the 'Postcode' field. I want it to do it each time after I've entered a character.
Private Sub Postcode_Change()
Me.List233.Requery
End Sub
This is the SQL code from my query:
SELECT [Main Contact Data].ID AS [Customer Number], [Title] & " " & [Firstname] & " " & [Surname] AS Name, [Main Contact Data].Postcode
FROM [Main Contact Data]
WHERE ((([Main Contact Data].Postcode) Like [Forms]![AlexLightDatabaseNEW]![Postcode] & "*"))
ORDER BY [Main Contact Data].Postcode;
The whole idea of this is to try and stop the users from entering the same person twice into the database without having to do a tedious search each time they enter somebody.
Any suggestions would be appreciated. Thanks.