General discussion

Locked

Access 2000 Visual Basic

By BobTheBuilder ·
I have a form that shows all the fields for one record in a database. I currently use the Find button to find a particular record matching the key field, which is in the format of a single number.
I would like to type the key field contents into a Text box to find a range of records from which I can select the correct one, as this would be quicker.
As an example I want to list in a list box all numbers containing 8123. There may be three records that match this e.g. 8123.1, 8123.2 and 8123.3 . These would show in the Listbox. I could then select one of them and all the fields in the form would be shown for this record. If no records are found I would like a message to show no records found.
Can anyone please let me know the VB code to do this?

This conversation is currently closed to new comments.

4 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Comments

Collapse -

by sgt_shultz In reply to Access 2000 Visual Basic

bob, you are gonna love the Northwind sample database AND associated help file located in the tools (i believe) folder on your installation cd. in it is a form that does exactly as you wish and the help file will tell you how it works. if you can't find it you can google northwind sample database and download it but you really want to find the cd with the help file imho. i belive what you want is a subform filtered with wildcards and/or the 'like' . depending on how you are organized

Collapse -

by BobTheBuilder In reply to

Hello sgt shultz, thanks for the tip about the Northwind database.
I have looked at the forms,
and the only form that is close to what I am looking for is the Orders form.
However, I want to show only the records that contain the characters that I type in.
This form shows all records. Perhaps the underlying Query can be modified, but I do not
know how to do this. I also need a warning message to appear if the text that I type in
is not contained in any record. I hope that you can help me with this.

Collapse -

by sgt_shultz In reply to Access 2000 Visual Basic

didja get the help file? take a look at the customer phone list. see how it uses 'like' to pick the records. maybe that is what you want...

Collapse -

by BobTheBuilder In reply to

Hello sgt_shultz
Sorry for the delay, I do have much time to spend on Access.
I did find the Help file.
I have looked at the Customer Phone list form and the macro. It does not do quite what I am looking for but I have tried to create a form and macro based on it.
My form has a Combo box and I run a macro, when the focus is lost on this Combo box.
In the macro I have no conditions, the action is ApplyFilter and the Where condition is [jobno] like "8607*".
If the form is in Datasheet view three records are shown which contain 8607.
This is fine but I can only select the first record. When I change to Form view only the first record is selectable. I think I am nearly there but I need all the filtered records to display in the Combo box, and I need to be able to type the filter criteria in the same Combo box.
Can you tell me how to do this?
Bob the builder

Back to Software Forum
4 total posts (Page 1 of 1)  

Related Forums