Simple VBA help required please.

vwgolfman

Registered User.
Local time
Today, 08:33
Joined
May 26, 2008
Messages
35
Hi,
I need some VBA to perform a simple task. I am novice and would like to ask if some kind soul would write the code for me in order that I can learn by looking at it.

I have 3 tables:
1) Companies
2) Countries
3) Combinations

The Combinations table is a joining table and its soul purpose is to hold relationships between Companies and Countries.
For the time being a Company will only ever be related to ONE country and vice-versa.

I have a ComboBox on a form showing the list of Companies.
The database has several reports (one for each country).
When the user selects a Company from the ComboBox I need the VBA to determine to which Country the Company is related in order that I can call the correct report.

Please can I have help on how to do this?

Thank you.
 
Send me what you got and I can help

Please elaborate on what exactly what you are trying to do.

This seems relatively easy but it is something someone would really have to look at to offer a solution. depends on how you have everything set up
 
Hi ctechnumber1 and thak you for your reply.

I have the following tables and relationships (see attached image).

On a form I have a ComboBox showing a dropdown list of companies.
There is a button next to the ComboBox.
There is a different report for each country.
When the user selects a company and clicks the button, I want to run the report for the country to which the company is related.

What is the best way to do this please?
 

Attachments

  • Image1.gif
    Image1.gif
    7.7 KB · Views: 95
It's OK I have done it :)

I added the country to the select clause which populates the control (bound column 1 so it only shows the company in the dropdown).

I then referred to the control in my VBA as ComboBox.Column(1)

That enabled me to pick up the country for the selected company :)
 

Users who are viewing this thread

Back
Top Bottom