AllExperts > Using MS Access 
Search      
Using MS Access
Volunteer
Answers to thousands of questions
 Home · More Using MS Access Questions · Answer Library  · Encyclopedia ·
More Using MS Access Answers
Question Library

Ask a question about Using MS Access
Volunteer
Experts of the Month
Expert Login

Awards

About Us
Tell friends
Link to Us
Disclaimer

 
 
 
 
About Scottgem
Expertise
I can answer almost all types of questions relating to Microsoft Access usage and application design. My strengths are database and interface design.

Experience
I've been designing databases for over 15 years working with dBase, FoxPro, Approach and Access.

Organizations
Author of Microsoft Office Access 2007 VBA
Techncial Editor for Special Edition Using Microsoft Access 2007 and Access 2007 Forms, Reports & Queries From Que Publishing

 
   

You are here:  Experts > Computing/Technology > Business Software > Using MS Access > On dbl click open form where combobox value is equal clicked value

Using MS Access - On dbl click open form where combobox value is equal clicked value


Expert: Scottgem - 11/5/2009

Question
Hi Scott,

when a project name in my continous form "Open Opportunities list" is double clicked another form (called Opportunities2) shall open and show the respective project details.

In Opportunities2 there is a Combobox (Combo33) in which the project name can be selected and then the details appear. The combobox displays not only the project name, but also customer and employee in charge for this project. The row source for this combobox is the following:

SELECT Opportunities.[Projet ID], Opportunities.[Project name], Customers.Company, Employees.[First Name], Employees.[Last Name] FROM Customers RIGHT JOIN (Employees RIGHT JOIN Opportunities ON Employees.ID=Opportunities.[TS Specialist]) ON Customers.ID=Opportunities.Customer ORDER BY Opportunities.[Project name];

I tried your solution from another posted question in the following way, but it did not work:

Private Sub Project_name_DBlClick(Cancel As Integer)
DoCmd.OpenForm "Opportunities2", , , "[Combo33] = '" & [Project name] & "'"
End Sub

Is it possible to link those two forms?

I would appreciate your help very much.

Kind regards,  

Answer
You seem to have misunderstood my solution. The problem is that you are not using the WHERE clause properly. The syntax for a WHERE clause is:

[fieldname] operator expression.

You are using a CONTROLNAME rather than a field name as the left side of the clause.

Also, you should NOT be using name as your comparison, since you have a ProjectID field. Your code should be more like:

DoCmd.OpenForm "Opportunities2", , , "[ProjectID] = " & Me.[ProjectID]

But frankly, I wouldn't do it that way. Instead, I would use the Combobox wizard and create a "Search" combo (third option) in the header of Opportunities2 and do away with the list form.

Hope this helps,
Scott<>
Microsoft Access MVP 2007
Author: Microsoft Office Access 2007 VBA


Add to this Answer   Ask a Question


 
User Agreement | Privacy Policy | Kids' Privacy Policy | Help
Copyright  © 2008 About, Inc. AllExperts, AllExperts.com, and About.com are registered trademarks of About, Inc. All rights reserved.