adding new 2 date to the array

User avatar
sal21
PlatinumLounger
Posts: 4353
Joined: 26 Apr 2010, 17:36

adding new 2 date to the array

Post by sal21 »

Code: Select all

...
Set RS = New ADODB.Recordset
    RS.CursorLocation = adUseClient
    'Debug.Print SQL
    SQL = "SELECT GG FROM CALENDARIO_FESTIVI"
    RS.Open SQL, CON, adOpenForwardOnly, adLockReadOnly
    RS.Sort = ("GG")

    'Dim K As Integer

    RS.MoveFirst
    Erase STRDBROWS()
    STRDBROWS = RS.GetRows()
    RS.Close
    Set RS = Nothing
...
note:
GG are dateS

how to add at runtime to STRDBROWS a new 2 date, for example:
17/04/2022
18/04/2022

User avatar
SpeakEasy
4StarLounger
Posts: 544
Joined: 27 Jun 2021, 10:46

Re: adding new 2 date to the array

Post by SpeakEasy »

Consider the following:

Code: Select all

    ReDim STRDBROWS(5) As Date ' equivalent to Erase STRDBROWS():STRDBROWS = RS.GetRows() for purposes of illustration (assuming GG is actually a Date field)
    
    ReDim STRDBROWS(UBound(STRDBROWS) + 2) As Date
    STRDBROWS(UBound(STRDBROWS) - 1) = CDate("17/04/2022")
    STRDBROWS(UBound(STRDBROWS)) = CDate("18/04/2022")

User avatar
sal21
PlatinumLounger
Posts: 4353
Joined: 26 Apr 2010, 17:36

Re: adding new 2 date to the array

Post by sal21 »

SpeakEasy wrote:
25 Sep 2022, 18:19
Consider the following:

Code: Select all

    ReDim STRDBROWS(5) As Date ' equivalent to Erase STRDBROWS():STRDBROWS = RS.GetRows() for purposes of illustration (assuming GG is actually a Date field)
    
    ReDim STRDBROWS(UBound(STRDBROWS) + 2) As Date
    STRDBROWS(UBound(STRDBROWS) - 1) = CDate("17/04/2022")
    STRDBROWS(UBound(STRDBROWS)) = CDate("18/04/2022")
WOW...
tks