J
Jenna B
Hi -
I have three combo boxes -
1. Company
2. Division
3. Contact
- on my form.
When a company is selected, all the divisions of that company populate the
"Division" combobox, and when a division is selected, the same occurs with
the "Contact" combobox, to show all the contacts that are assigned to that
specific division.
I have this process working correctly.
I used a Union qry to add "(Company Not Listed)" to the top of the Company
cbo for the user to select if the company they are looking for isn't listed.
If the user selects "(Company Not Listed)", a form opens to allow them to add
a new company.
The code for this is:
If Me.cboBusDevCompany.Column(1) = "(Company Not Listed)" Then
DoCmd.OpenForm "frmCompanyAddNew", acNormal, , , acFormAdd
End If
(The form opens as it should at this point.)
My problem is this:
The "(Not Listed)" option should appear in all three cbos
(Company/Division/Contact). It works correctly in the company cbo. But, when
I attempted to add it to the division cbo, it doesn't show anything.
(Meaning: no data is shown at all, no text, just a blank box)
Source code for Company cbo (which works):
SELECT tblCompany.CompID, tblCompany.CompName FROM tblCompany UNION Select 0
as NotListedChoice, "(Company Not Listed)" as Bogus from tblCompany;
Source code for Division cbo (which doesn't work):
SELECT tblDivision.DivID, tblDivision.DivName, tblDivision.DivCompanyID FROM
tblDivision UNION Select 0 as NotListedChoice, "(Division Not Listed)" as
Bogus from tblDivision WHERE
(((tblDivision.DivCompanyID)=Forms!frmBusDev!cboBusDevCompany)) ORDER BY
tblDivision.DivName;
Current source code for Contact cbo (which I haven't modified yet):
SELECT tblContact.ContactID, tblContact.ContactDivision, [ContactLastName] &
", " & [ContactFirstName] AS ContactName FROM tblContact WHERE
(((tblContact.ContactDivision)=Forms!frmBusDev!cboBusDevDivision)) ORDER BY
tblContact.ContactLastName;
I'm assuming this problem has to do with the way I've formed the Union qry
or the fact that two of the combo boxes are based on the one before.
Additionally, after the user clicks the "Not Listed" option, and then adds a
new company/division or contact, I want the new/updated info to appear in the
cbo. Where should I include requery?
I would really appreciate help in figuring out how to get this to work. If
you need more info, please let me know.
Thanks!
I have three combo boxes -
1. Company
2. Division
3. Contact
- on my form.
When a company is selected, all the divisions of that company populate the
"Division" combobox, and when a division is selected, the same occurs with
the "Contact" combobox, to show all the contacts that are assigned to that
specific division.
I have this process working correctly.
I used a Union qry to add "(Company Not Listed)" to the top of the Company
cbo for the user to select if the company they are looking for isn't listed.
If the user selects "(Company Not Listed)", a form opens to allow them to add
a new company.
The code for this is:
If Me.cboBusDevCompany.Column(1) = "(Company Not Listed)" Then
DoCmd.OpenForm "frmCompanyAddNew", acNormal, , , acFormAdd
End If
(The form opens as it should at this point.)
My problem is this:
The "(Not Listed)" option should appear in all three cbos
(Company/Division/Contact). It works correctly in the company cbo. But, when
I attempted to add it to the division cbo, it doesn't show anything.
(Meaning: no data is shown at all, no text, just a blank box)
Source code for Company cbo (which works):
SELECT tblCompany.CompID, tblCompany.CompName FROM tblCompany UNION Select 0
as NotListedChoice, "(Company Not Listed)" as Bogus from tblCompany;
Source code for Division cbo (which doesn't work):
SELECT tblDivision.DivID, tblDivision.DivName, tblDivision.DivCompanyID FROM
tblDivision UNION Select 0 as NotListedChoice, "(Division Not Listed)" as
Bogus from tblDivision WHERE
(((tblDivision.DivCompanyID)=Forms!frmBusDev!cboBusDevCompany)) ORDER BY
tblDivision.DivName;
Current source code for Contact cbo (which I haven't modified yet):
SELECT tblContact.ContactID, tblContact.ContactDivision, [ContactLastName] &
", " & [ContactFirstName] AS ContactName FROM tblContact WHERE
(((tblContact.ContactDivision)=Forms!frmBusDev!cboBusDevDivision)) ORDER BY
tblContact.ContactLastName;
I'm assuming this problem has to do with the way I've formed the Union qry
or the fact that two of the combo boxes are based on the one before.
Additionally, after the user clicks the "Not Listed" option, and then adds a
new company/division or contact, I want the new/updated info to appear in the
cbo. Where should I include requery?
I would really appreciate help in figuring out how to get this to work. If
you need more info, please let me know.
Thanks!