Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Why the code below does not select a record falling betwee two dates

Status
Not open for further replies.

toolsofministry

Programmer
Sep 11, 2002
24
US
Dim todaysdate As Date
crPrintAssignments.DiscardSavedData
todaysdate = Date
crPrintAssignments.RecordSelectionFormula = &quot;{ado.DateofNexVisit} <= '&quot; & todaysdate & &quot;'&quot;
crPrintAssignments.PrintOut False ', 1, False, 1, 1

Can someone tell me why the formula shown does not print the records that are <= to the current date (Computer Date)?

Thanks,

Gerald J. Robinson
 
Gerald,

You should be able to set the RecordSelectionFormula if you change the single quotes to pound signs. This lets CR know to expect a date rather than a string.

&quot;{ado.DateofNexVisit} <= #&quot; & todaysdate & &quot;#&quot;

Hope this helps,
Tim
 

&quot;{ado.DateofNexVisit} <=Date&quot; & Format$(todaysdate,&quot;yyyy,mm,dd&quot;) [/b][/i][/u]*******************************************************
General remarks:
If this post contains any suggestions for the use or distribution of code, components or files of any sort, it is still your responsibility to assure that you have the proper license and distribution rights to do so!
 
{ado.DateofNexVisit} <= DATE

OR ado.DateofNexVisit <= & &quot;'&quot; & todaysdate & &quot;'&quot;
 
I forgot the brackets:

&quot;{ado.DateofNexVisit} <=Date(&quot; & Format$(todaysdate,&quot;yyyy,mm,dd&quot;) & &quot;)&quot;

If the date is always todays date, then of course Nunina first example should work .

Nunina's second example will definitly not always work though.
[/b][/i][/u]*******************************************************
General remarks:
If this post contains any suggestions for the use or distribution of code, components or files of any sort, it is still your responsibility to assure that you have the proper license and distribution rights to do so!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top