linking sub form unbound
RH

Forum home » Delegate support and help forum » Microsoft Access VBA Training and help » Linking a sub form to an unbound combo box | Access forum

Linking a sub form to an unbound combo box | Access forum

resolvedResolved · High Priority · Version 2007

Marc has attended:
Access VBA course

Linking a sub form to an unbound combo box

Hi

I have a form with a couple of unbound combo boxes with the values of AdviserName and SCIID (ref no of the project).

How it works is that when you choose the Adviser Name, the second combo box displays the assignments which pertain only to that Adviser.

However, what I need next is to have sub form which has all the fields where the Adviser makes claims for the particular assignment. So i need to linked the sub form to whatever value (SCIID) is chosen in the combo box.

For example, if I choose MLF000300, then the the cliam information pertaining to that record will be shown in the sub form. I can normally link sub form to master forms using child and master fields, but of course, as I am using VBA, it is more dififcult.

Any help please for the coding that will solve this?

thanks

Marc

RE: Linking a sub form to an unbound combo box

Hi Marc, thanks for your query. This is definitely something requiring code.

The code will be placed in the AfterUpdate event of the SCIID combo box.

You'll need to pass the value of that combobox to a variable.

You will need to concatenate that variable into a SQL query retrieving the values you want to put into the sub-form.

You'll need to set the rowsourcetype of the form to "Table/Query" and the rowsource to your SQL.

If you've retrieved multiple fields via the query you'll need to set the columncount to match that number, otherwise you won't see much.

A lot of this is already in our training code, but the combination of techniques is what differs out in the real world and is often not immediately obvious. Have a go and see how you get on.

Anthony

Wed 11 Jul 2012: Automatically marked as resolved.

 

Training courses

 

Training information:

Welcome. Please choose your application (eg. Excel) and then post your question.

Our Microsoft Qualified trainers will then respond within 24 hours (working days).

Frequently Asked Questions
What does 'Resolved' mean?

Any suggestions, questions or comments? Please post in the Improve the forum thread.


 

Access tip:

Remove spaces in a table

If you have a table that has too many space marks littered around, you can create a update query and use the trim function to get rid of any excess space marks

View all Access hints and tips


Server loaded in 0.06 secs.