|
code
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Is it Monday yet?I have a recordset that I wish to cycle through until my 'cursor' is
pointing to a record with a date that is a MONDAY. Your opinion. Would this be the way to do it? 'Set Recordset to point to first date that is a MONDAY Do While Not (Weekday(Rs!Date.Value) = vbMonday Or Rs.EOF) Rs.MoveNext Loop If Rs.EOF then bFailed = True 'Went to end of file with no Monday or found only at the very end. Not acceptable. Thanks. Webbiz "Webbiz" <nospam@forme.thanks.com> wrote in message You can use Weekday in a SQL statement.news:f404251bcmcbmo5eq9ni77a750dv62ut0f@4ax.com... >I have a recordset that I wish to cycle through until my 'cursor' is > pointing to a record with a date that is a MONDAY. > > Your opinion. Would this be the way to do it? > > 'Set Recordset to point to first date that is a MONDAY > Do While Not (Weekday(Rs!Date.Value) = vbMonday Or Rs.EOF) > Rs.MoveNext > Loop Using DAO, rst.FindNext "Weekday(CalDate) = 2" Finding first Monday (one way), sCriteria = "SELECT CalReport.* FROM CalReport WHERE " _ & "Weekday(CalDate) = 2 ORDER BY CalDate" Set rst = db.OpenRecordset(sCriteria, dbOpenDynaset) If rst.RecordCount Then Debug.Print rst.Fields("CalDate") End If David
Show quote
Hide quote
"Webbiz" <nospam@forme.thanks.com> wrote in message Have you used "ORDER BY Date"?news:f404251bcmcbmo5eq9ni77a750dv62ut0f@4ax.com... >I have a recordset that I wish to cycle through until my 'cursor' is > pointing to a record with a date that is a MONDAY. > > Your opinion. Would this be the way to do it? > > 'Set Recordset to point to first date that is a MONDAY > Do While Not (Weekday(Rs!Date.Value) = vbMonday Or Rs.EOF) > Rs.MoveNext > Loop > > If Rs.EOF then bFailed = True 'Went to end of file with no Monday > or found only at the very end. Not acceptable.
What files should I distribute (SAPI 5.3)?
How to test for array? Stone Wall GW-Basic DLL in Visual BASIC 6 Format function question..... Anyone know of a good Help Authorizing Tool Getting pixels from EMF (StdPicture) GetObject with VB6 ActiveX exe Mayayana and others: Know The Notes now for 98SE using MM's new 'Never Replace' scheme |
|||||||||||||||||||||||