Listbox Selection Help!

Freakinchair

New member
Local time
Today, 15:32
Joined
Aug 7, 2007
Messages
8
Hey guys - I'm somewhat new to Access and I've been put in charge of developing a user interface for an already established database. Basically - all of the relationships and values are in place.

I've already constructed a "Search" form where the user can sort all of the records presented in a listbox (did this using queries).

My problem is that I need the user to be able to click on a record in the listbox and it will open a new form containing information about that chosen record. The new form that is opened will have other forms linked to it (subforms?) containing other pieces of information (where one-to-many relationships are present). All of the information contained within these forms must be editable and updated within the database (through a button which will save the changes on the current form).

The unique key for each record is an attribute named "FILE_NUMBER_CD".

Basically what I need to know is how to set the new form that is opened from clicking on a record in the listbox to the proper record that was selected. This has been driving me nuts for a while now so any help would be much appreciated. If you need more information just let me know what you need.
 
Welcome to the Forums!

Add a new button to your source form and use the wizard for Form\Open a Form.

Select the form that you intend to open.

When asked, choose the option to 'find specific data'.

Select the fields that link the two forms (FILE_NUMBER_CD) and click the <-> button; the 'Matching Field' display will update to show your selection. Note: for your solution you should choose the Select Box at this stage, make sure you know what it is called before using this wizard and that it's Bound Column relates to FILE_NUMBER_CD.

Click finish.

Now, test the button. Select an entry in the list box and click on the Open Form button you just displayed, close the new form and try again with a different selection. Hopefully everything will be working fine.

Now, in design view go to the Open Form button, show the properties and click on the 'On Click' event, next click on the ... button to view the code.

Examine the code and use a modified version in the On Click event of the list box. You should change the names of the Err_, and Exit_ lines so that they match the listbox name, instead of the command button name.

If you have any problems with this, get back to us with the specifics.

HTH

Tim
 
Thanks alot - it worked! You know, the code that the button generated I mustve tried in a million different ways but it never worked. Sometimes the simplest solution is the best as it was in this case.

Thanks Again.
 

Users who are viewing this thread

Back
Top Bottom