Full Version: Need 2 Fields to Post In ComboBox
UtterAccess Discussion Forums > Microsoft® Access > Access Forms
shep
I have a report that shows phone calls for a selected Contact for a select period.

I have a Date Range Form on which I put an unbound ComboBox to select a Contact for a report. The row source for the ComboBox:
SELECT Contacts.ContactID, qryContactNameV1.ContactName
FROM Contacts INNER JOIN qryContactNameV1 ON Contacts.ContactID = qryContactNameV1.ContactID;

I have Col count =2, and widths = 0.5";2"

I have a query for the report:
SELECT qryContactNameV1.ContactID, qryContactNameV1.ContactName, Calls.CallDate, Calls.CallTime, Calls.Subject, Calls.Notes
FROM Calls INNER JOIN qryContactNameV1 ON Calls.ContactID = qryContactNameV1.ContactID
WHERE (((qryContactNameV1.ContactID)=[Forms]![frmReportDateRangeForCallsV1]![ContactSe
l]) AND ((Calls.CallDate)>=[forms]![frmReportDateRangeForCallsV1]![Start Date] And (Calls.CallDate)<=[forms]![frmReportDateRangeForCallsV1]![End Date]))
ORDER BY qryContactNameV1.ContactName;

I When I click the ComboBox for drop down list, it shows both ContactID and ContactName. But when I select, only the ID posts in the field. I need the ID for ease of navigating to the correct Contact out of several thousand; however if only the ID posts it may be disconcerting to the user.

How can I get the ID and Name to post?

Thanks
dashiellx2000
You only want the ID to be recorded to the table. If you need the name to show on the table for a user confidence issue that add an unbound text box and have this =Me.ComboBoxName.Column(1).

HTH.
shep
Thanks for your response.
I entered =[Me].[ContactSel].[Column](1) in Control Source of the unbound text box and it returns #Name?

The ComboBox name is ContactSel

What might I have done wrong?

Thanks
Larry Larsen
Hi
Remind me on how many columns has your combo got..?
Also lose some of the characters..
From:
=[Me].[ContactSel].[Column](1)
To:
=[ComboControlName].Column(1)

Ps: Just a note when referencing columns they start at (0),1,2,3,4,etc..


thumbup.gif
shep
The code change did it; many thanks!

The ComboBox has two columns.

Again, thanks to both of you
Larry Larsen
Hi
You're welcome and glad we could assist..
thumbup.gif
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.