Pick List In Report

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

MS Office 2003 Pro

I have a table that stores phone calls with contacts:
Table: Calls
Columns
Name Type Size
CallID Long Integer 4
ContactID Long Integer 4
CallDate Date/Time 8
CallTime Date/Time 8
Subject Text 255
Notes Memo

I have a query to call a Date Range Form, which includes a Popup calendar to
set date range for a report of calls:

Query: qryCallsV1
SQL
SELECT qryContactNameV1.ContactName, Calls.CallDate, Calls.CallTime,
Calls.Subject, Calls.Notes
FROM Calls INNER JOIN qryContactNameV1 ON
Calls.ContactID=qryContactNameV1.ContactID
WHERE (((Calls.CallDate)>=forms!frmReportDateRangeV1![Start Date] And
(Calls.CallDate)<=forms!frmReportDateRangeV1![End Date]))
ORDER BY qryContactNameV1.ContactName;
Columns
Name Type Size
ContactName Text 0
CallDate Date/Time 8
CallTime Date/Time 8
Subject Text 255
Notes Memo N/

I would like to also be able to select a Contact for the report rather than
getting all contacts. How can I do that?

Thanks
 
Shep,

On your frmReportDateRangeV1 form, as well as the controls for the date
range selection, you can put an unbound combobox, where the Row Source
will be based on the list of Contacts. Probably the most commonly used
approach here would be 2 columns in the combobox, with ContactID and
ContactName, with Column Widths property set so that ContactID is the
bound column but hidden and ContactName is displayed. Let's say this
combobox is named ContactSel, then in the query for the report, you will
put this in the Criteria of the ContactID field...
[Forms]![frmReportDateRangeV1]![ContactSel]
.... and thus the Where clause of the query's SQL will look something
like this...
WHERE (((Calls.CallDate) Between
[Forms]![frmReportDateRangeV1]![Start Date] And
[Forms]![frmReportDateRangeV1]![End Date]) And
((Calls.ContactID)=[Forms]![frmReportDateRangeV1]![ContactSel]))
 
Thank you very Much; Just what I needed

Steve Schapel said:
Shep,

On your frmReportDateRangeV1 form, as well as the controls for the date
range selection, you can put an unbound combobox, where the Row Source
will be based on the list of Contacts. Probably the most commonly used
approach here would be 2 columns in the combobox, with ContactID and
ContactName, with Column Widths property set so that ContactID is the
bound column but hidden and ContactName is displayed. Let's say this
combobox is named ContactSel, then in the query for the report, you will
put this in the Criteria of the ContactID field...
[Forms]![frmReportDateRangeV1]![ContactSel]
.... and thus the Where clause of the query's SQL will look something
like this...
WHERE (((Calls.CallDate) Between
[Forms]![frmReportDateRangeV1]![Start Date] And
[Forms]![frmReportDateRangeV1]![End Date]) And
((Calls.ContactID)=[Forms]![frmReportDateRangeV1]![ContactSel]))

--
Steve Schapel, Microsoft Access MVP

MS Office 2003 Pro

I have a table that stores phone calls with contacts:
Table: Calls
Columns
Name Type Size
CallID Long Integer 4
ContactID Long Integer 4
CallDate Date/Time 8
CallTime Date/Time 8
Subject Text 255
Notes Memo

I have a query to call a Date Range Form, which includes a Popup calendar to
set date range for a report of calls:

Query: qryCallsV1
SQL
SELECT qryContactNameV1.ContactName, Calls.CallDate, Calls.CallTime,
Calls.Subject, Calls.Notes
FROM Calls INNER JOIN qryContactNameV1 ON
Calls.ContactID=qryContactNameV1.ContactID
WHERE (((Calls.CallDate)>=forms!frmReportDateRangeV1![Start Date] And
(Calls.CallDate)<=forms!frmReportDateRangeV1![End Date]))
ORDER BY qryContactNameV1.ContactName;
Columns
Name Type Size
ContactName Text 0
CallDate Date/Time 8
CallTime Date/Time 8
Subject Text 255
Notes Memo N/

I would like to also be able to select a Contact for the report rather than
getting all contacts. How can I do that?

Thanks
 
Back
Top