Using mutiple calendar controls with same control source

pwalter83

Registered User.
Local time
Today, 15:24
Joined
Dec 19, 2011
Messages
31
Hi,

I am having an issue in a form I have designed.

On the form I need to give the user the option to select a 'from date' and 'to date' and for this I have put in 2 calender controls which have the same control source(same table column). The problem I am facing is when I select a date from one calendar, the other calendar control automatically populates with the same date and vice versa.

I need to have a functionality where 2 different date can be selected and then when the Search button is clicked, then data within the date ranges should be displayed.

Can somebody please tell what changes I need to make to acomplish this ? Please find a screenshot of the form attached.

Thanks.
 

Attachments

  • screen.png
    screen.png
    16 KB · Views: 107
Those two Controls need to be UNBOUND. Not bound.
 
Those two Controls need to be UNBOUND. Not bound.

Thanks for your reply, it was helpful. I need one last assistance in terms of designing a query for the Search button. This is the query I have designed but dont know how to incoporate 'from date' and 'to date' in the where clause ?

------------------------------------
SELECT dbo_VESSEL.VESSEL_NAME, dbo_VESSEL.VESSEL_CD, dbo_VESSEL.VOYAGE_NUM, dbo_VESSEL.PORT_CD, dbo_VESSEL.DEPART_ACTUAL_DT, dbo_VESSEL.DIVISION_CD
FROM dbo_VESSEL
WHERE (((dbo_VESSEL.VESSEL_CD) Like [Forms]![VESSDAT].[Form]![txtvessel])) OR (((dbo_VESSEL.VOYAGE_NUM) Like [Forms]![VESSDAT].[Form]![txtvoyage])) OR (((dbo_VESSEL.PORT_CD) Like [Forms]![VESSDAT].[Form]![txtport])) OR (((dbo_VESSEL.DEPART_ACTUAL_DT) Like [Forms]![VESSDAT].[Form]![txtfromdept] And (dbo_VESSEL.DEPART_ACTUAL_DT) Like [Forms]![VESSDAT].[Form]![txttodept]));
---------------------------
 
Try this query.
Code:
SELECT dbo_VESSEL.VESSEL_NAME, dbo_VESSEL.VESSEL_CD, dbo_VESSEL.VOYAGE_NUM, dbo_VESSEL.PORT_CD, dbo_VESSEL.DEPART_ACTUAL_DT, dbo_VESSEL.DIVISION_CD
FROM dbo_VESSEL
WHERE (
(dbo_VESSEL.VESSEL_CD Like [Forms]![VESSDAT].[Form]![txtvessel]) OR 
(dbo_VESSEL.VOYAGE_NUM Like [Forms]![VESSDAT].[Form]![txtvoyage]) OR 
(dbo_VESSEL.PORT_CD Like [Forms]![VESSDAT].[Form]![txtport]) OR 
(dbo_VESSEL.DEPART_ACTUAL_DT [COLOR=Red][B]BETWEEN [/B][/COLOR][Forms]![VESSDAT].[Form]![txtfromdept] [COLOR=Red][B]And [/B][/COLOR][Forms]![VESSDAT].[Form]![txttodept]));
 
Try this query.
Code:
SELECT dbo_VESSEL.VESSEL_NAME, dbo_VESSEL.VESSEL_CD, dbo_VESSEL.VOYAGE_NUM, dbo_VESSEL.PORT_CD, dbo_VESSEL.DEPART_ACTUAL_DT, dbo_VESSEL.DIVISION_CD
FROM dbo_VESSEL
WHERE (
(dbo_VESSEL.VESSEL_CD Like [Forms]![VESSDAT].[Form]![txtvessel]) OR 
(dbo_VESSEL.VOYAGE_NUM Like [Forms]![VESSDAT].[Form]![txtvoyage]) OR 
(dbo_VESSEL.PORT_CD Like [Forms]![VESSDAT].[Form]![txtport]) OR 
(dbo_VESSEL.DEPART_ACTUAL_DT [COLOR=red][B]BETWEEN [/B][/COLOR][Forms]![VESSDAT].[Form]![txtfromdept] [COLOR=red][B]And [/B][/COLOR][Forms]![VESSDAT].[Form]![txttodept]));

Thanks a ton for your suggestion !! it worked !!
 

Users who are viewing this thread

Back
Top Bottom