filtering one form from another

J

JohnE

I am in a quandry as to get a combo box on a form to filter from another.
What I have is the following:

mainform = usrfrmClientSelection
cbx = cbxClientSelectionList
popup/modal form = frmAlphaSelect
cbo = cboAccountPerson

What I am trying to do is limit the clients showing in cbxClientSelectList
based on the name that is in cboAccountPerson.

I have been trying to use the following code with moving parts of it around.
But I continue to get the system input box asking for the cboAccountPerson
parameter. I get the message even when I go to close the mainform.

Forms![usrfrmClientSelection]!cbxClientSelectionList].SetFocus

Forms![usrfrmClientSelection]![cbxClientSelectionList].RowSource = _
"SELECT " & _
"ClientID, " & _
"ClientName, " & _
"ClientDBA, " & _
"ClientCode, " & _
"AccountManagementPerson, " & _
"AcctMgtPersonSupervisor " & _
"FROM usrtblClientInformation " & _
"WHERE (((AccountManagementPerson) =
[Forms]![frmAlphaSelect]![cboAccountPerson])) " & _
"ORDER BY ClientName ASC;"

Forms![usrfrmClientSelection]![cbxClientSelectionList].Dropdown
DoCmd.Close acForm, "frmAlphaSelect"
Forms![usrfrmClientSelection]![cbxClientSelectionList].Dropdown

If anyone can see the error of my ways, please let me know and how to correct.
Thanks in advance for any assistance.
*** John
 
S

Steve Schapel

John,

Where is this code being called from?

Anyway, try this...
"WHERE ((AccountManagementPerson)='" &
[Forms]![frmAlphaSelect]![cboAccountPerson] & "') "
 

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