Combo box query

C

cp2599

I want to have the values in a combo box on one tab to reflect the
values entered on a different tab both for the same application. I
can't seem to get the WHERE clause to reflect the current
application. Using the sample tables below, one of the tabs will
populate the Proxy Table and the other tab will populate the Work
Table. On the Work tab, I want a ProxyName dropdown that will display
all of the ProxyNames in the Proxy Table for the current application.
Is this possible?

Application Table
ApplID (key)

Proxy Table - mult entries per Application
ProxyID (key)
ApplID (foreign key)
ProxyName

WorkTable - mult entries per Application
WorkID (key)
ApplID (foreign key)
ProxyName (foreignkey)
WorkHours
 
C

cp2599

Not sure what you mean by 'application'. You are in an Access project so what
are the 'applications' that can be selected and how is one selected. Might
help analysis to show your code attempting to set the combobox RowSource.

Application is what is used to apply for a job.

SELECT tblProxy.ProxyName FROM tblApplication LEFT JOIN tblProxy ON
tblApplication.ApplID = tblProxy.ApplID WHERE tblApplication.ApplID =
<the specific application I'm displaying on the form>
 
C

cp2599

This code is in the RowSource property of the 2nd combobox? In place of the
'<the specific application I'm displaying on the form>', I hope you actually
have the 1st combobox name, like:
SELECT tblProxy.ProxyName FROM tblApplication LEFT JOIN tblProxy ON
tblApplication.ApplID = tblProxy.ApplID WHERE tblApplication.ApplID ='" &
1stcomboboxname & "'"
Are you using the AfterUpdate event of lst combobox with Requery method on
the 2nd combobox? Is it possible for users to get to the 2nd combobox first?
How would this affect the data selection?
Not sure what you mean by 'application'. You are in an Access project so what
are the 'applications' that can be selected and how is one selected. Might
[quoted text clipped - 27 lines]
- Show quoted text -
Application is what is used to apply for a job.
SELECT tblProxy.ProxyName FROM tblApplication LEFT JOIN tblProxy ON
tblApplication.ApplID = tblProxy.ApplID WHERE tblApplication.ApplID =
<the specific application I'm displaying on the form>

On the continuous subform in the On Load and Current event, I set the
RowSource for the combo box to equal "SELECT ProxyID, ProxyName from
tblProxy WHERE ApplID = " & Me.ApplID & " and InactiveFlag = 0;" On
the format properties I had to change the number of columns and column
widths for the correct data to display. This made the dropdown work.

My next problem was the name disappeared from the combo box when I set
the inactive to yes. I still wanted the selected name on the record
to show on the form so I had to add another text box to store the name
since I was storing the ID with the combo box. To display the correct
value for each record, I had to add a ProxyName attribute to the Proxy
table. When I selected a value, I populated both the ID and the Name
attributes.

Thank you for your help.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top