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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Selecting and displaying the data 1

Status
Not open for further replies.

amorous

Programmer
Sep 5, 2003
1,008
US
Hi guys:

I have my DB set something like below:

ItemID |Itemname |Cmdate |Cmday
_______________________________
A11 | A11name |06/21/2004|Monday
A12 | A12name |06/21/2004|Monday
A13 | A13name |06/21/2004|Monday
A21 | A21name |06/22/2004|Tuesday
A22 | A22name |06/22/2004|Tuesday
A31 | A31name |06/23/2004|Wednesday

and so on....

I want to query this DB and fetch this week's results and display it in the dynamic table( on my ASP page) like below

Sunday|Monday|Tuesday|Wednesday|Thrusday|Friday|Saturday
__________________________________________________
A0name|A11name |A21name|A31name| .... and so on
|Al12name|A22name|
|Al13name|

Ok problems are ---

Problem 1: How do i do my select query to retrieve this week's data.....Starting from Sunday till Saturday for any week i want to see the same data...only on next Sunday data in the table should be updated with the new data...

Problem 2: How do i display this table dynamically as the items on one day is different from items on the other day...Also how i can get my recordset data displayed separately based on the name of the table column...

Any Suggestion..

Thanks in advance

-VJ
 
I think if I were doing this I would cheat. Either
a) Make the table with only one really tall row (with valign="top" and <br>'s between entries for the same day)
or
b) store your HTML in an array of strings. one string per row. That way you can loop one time through the recordset and just append values to the correct row, then output all the rows when you have finished looping.
or
c) make a complex SQL statement to number all the entries so you can reorder it into a M, T, W, Th, Fr, Sat, Sun, Mon, Tue, etc order.
or
d) pull the data into an array with an extr field set to false for each record. Find thefirst monday where the field is false, output it and set it's field to true, continue with each day until your entire array has their fields setto true.
or
e) magic :p

-T

01000111 01101111 01110100 00100000 01000011 01101111 01100110 01100110 01100101 01100101 00111111
The never-completed website:
 
Thanks for the reply Tarwn...I tried something like this but not successfully in achieving what i want...

here is the sample code
Code:
<tr>
<td>Sunday</td>
<td>Monday</td>
<td>Tuesday</td>
</tr>

<tr>

<% Do until rsSunday.EOF %>
<td> <%=rsSunday("value")%></td>
<%
rsSunday.MoveNext
Loop
%>
<BR>

<% Do until rsMonday.EOF %>
<td> <%=rsMonday("value")%></td>
<%
rsMonday.MoveNext
Loop
%>
<BR>

<% Do until rsTuesday.EOF %>
<td> <%=rsTuesday("value")%></td>
<%
rsTuesday.MoveNext
Loop
%>

</tr>
I dont get the line break after every record set....all values are displayed in a single row...

Any Suggestions

-VJ
 
Tarwn...

Can you show me a sample code for the method "b" or "d" you suggested..

Thanks in advance...

-VJ
 
Err...those would be rather involved, let me make some corrections to your code above first:
Code:
<tr>
<td>Sunday</td>
<td>Monday</td>
<td>Tuesday</td>
</tr>

<tr>
<%
'start the sunday cell
Response.Write "<td valign=""top"">"

'loop through sunday
Do Until rsSunday.EOF
   Response.Write rsSunday("value") & "<br>"
   rsSunday.MoveNext
Loop

'end sunday
Response.Write "</td>"

'start the Monday cell
Response.Write "<td>"

'etc, continue like i did sunday

01000111 01101111 01110100 00100000 01000011 01101111 01100110 01100110 01100101 01100101 00111111
The never-completed website:
 
Thanks Tarwn....that cheating trick did it...but my data is displayed in the below manner

Sunday|Monday|Tuesday|Wednesday|Thrusday
________________________________________
value11| |value31| |
value12| |value31| |
value13|value21| |value41|value51
|value22| | |value52

AS you can see not all columns are starting from the top??Can we do some trick to correct this to get the result like below...

Sunday|Monday|Tuesday|Wednesday|Thrusday
________________________________________
value11|value21|value31|value41|value51
value12|value22|value31| |value52
value13| | | |


thanks a lot...

-VJ
 
Does this disorder depend on the number of items in each recordset or does it depend on the recordset that has the maximum records?

-VJ

 
in reading this i noticed something and perchance might be of help, tarwn you seem to have a better grip of what he's after, and maybe you might be able to help in more depth...

the date/days in the dataset seem to match up, as each weekday advances, so does the date.

could you use weekday(givendate,vbmonday) to determine beginning and ending of a week as he needs, and in turn convert the numbers to proper names ( supplied some code i used before, below ) and also included is a function to "find" first day of week froma given date, this in turn could be used to pull a report on say wednesday , for monday thru wednesday, and leave thurs/fri/weekend empty

and for formatting, left to right instead of top to bottom ( which would be easier ) left to right dynamically generate array sets for each day of the week, then cycle all the sets in a loop, reporting the current fullset position like :

<determine biggest dataset prior>
for i = ubound(biggestarray)
if i <= ubound(monday) then
response.write "<td> Etc etc" & monday(i) & "</td>"
else
response.write "<td>&nbsp</td>"
end if
<repeat for each day array>
next


supplied functions to try and help :
Code:
Function DayName(DateValue)
    If IsDate(DateValue) Then
        Select Case WeekDay(DateValue, vbMonday)
            Case 1
                DayName = "Monday"
            Case 2
                DayName = "Tuesday"
            Case 3
                DayName = "Wednesday"
            Case 4
                DayName = "Thursday"
            Case 5
                DayName = "Friday"
            Case 6
                DayName = "Saturday"
            Case 7
                DayName = "Sunday"
        End Select
    Else
        DayName = "Error"
    End If
End Function

Function FindDate(DayVal,StartDate,FindBackward) ' findbackward is true/false to indicate direction from start to find first matching day
    StartDate = CDate(StartDate)
    If Not IsNumeric(DayVal) Then Exit Function
    DayVal = CInt(DayVal)
    On Error Resume Next
    If FindBackward Then
        For i = 1 To 8
            If WeekDay(StartDate - i, vbMonday) = DayVal Then
                FindDate = StartDate - i
                Exit Function
            End If
        Next
    Else
        For i = 0 To 6
            If WeekDay(StartDate + i, vbMonday) = DayVal Then
                FindDate = StartDate + i
                Exit Function
            End If
        Next
    End If
    FindDate = "Error"
End Function
 
Thanks Tarwn and Drexor...

Tarwn- I am still stuck with the ordered data with strange display( some column starts from the top and other columns start somewhere in between). So any suggestions??

Drexor---I am unable to figure out how to use your function in my code...

if suppose i have a recordset...

rsObj.Open("Select mydatevalue from mytable")

do you want me to do something like this

Function DayName(mydatevalue)

and i am not sure how to use your FindDate function??

Thanks

-VJ

 
well you're trying to pull, say, the numbers for the week of june 10th, which was a thursday. you use finddate to determine what the date was for monday ( or sunday however you do your week ) then you can use that founddate and founddate+7 and : select whatever from table where datefield between founddate and founddate+7 order by datefield

from there you can just handle the dates, use the dayname function for labelling ( column headers as you were showing before )
then you dim out 7 arrays ( monday, tuesday, etc ) founddate is your first array founddate+1 is your second array, as you loop through the recordset, you can either check against last used date or do a date difference and a case statement to push the value into the right array based on how many days difference there are.

once this is done you can use that for / next based on which ever array was largest, write out values if they exist, write out blanks if they dont. this will populate your table from top to bottom without odd blank spaces.

granted in the example/questions you're only showing one returned valueNN with the arrays you could dim them 2,3,4 dimentions and return as much as you need to.
 
Thanks Tarwn and Drexor...

Drexor-- This is what i have

<head>
<script language="vbscript">
Function FindDate(DayVal,StartDate,FindBackward) ' findbackward is true/false to indicate direction from start to find first matching day
StartDate = CDate(StartDate)
If Not IsNumeric(DayVal) Then Exit Function
DayVal = CInt(DayVal)
On Error Resume Next
If FindBackward Then
For i = 1 To 8
If WeekDay(StartDate - i, vbSunday) = DayVal Then
FindDate = StartDate - i
Exit Function
End If
Next
Else
For i = 0 To 6
If WeekDay(StartDate + i, vbSunday) = DayVal Then
FindDate = StartDate + i
Exit Function
End If
Next
End If
FindDate = "Error"
End Function

Function DayName(DateValue)
If IsDate(DateValue) Then
Select Case WeekDay(DateValue, vbMonday)
Case 1
DayName = "Monday"
Case 2
DayName = "Tuesday"
Case 3
DayName = "Wednesday"
Case 4
DayName = "Thursday"
Case 5
DayName = "Friday"
Case 6
DayName = "Saturday"
Case 7
DayName = "Sunday"
End Select
Else
DayName = "Error"
End If
End Function

</script>
</head>
<body>
<%
Dim FoundDate

I am not sure how to call the FindDate function to get the value of FoundDate so that i can use it in the below query..
is it something like this:
FoundDate=FindDate(1,Now(),1)
I hope StartDate is always Today's date-- am i right??


Set rsitem = Server.CreateObject("ADODB.Recordset")
Set ObjConn= Server.CreateObject("ADODB.Connection")
Sql = "SELECT * FROM mytable WHERE mydate BETWEEN FoundDate AND FoundDate+7 "
Set rsitem = ObjConn.Execute(Sql)
%>

'once i get the mydatevalues-- rsitem("mydate")

i have to use the DayName Function---is it something like this:

<%
Dim mydate
Do Until rsitem.EOF
mydate=rsitem("mydate")
'call the DayName function <--- i am not sure how to call--
can i directly write <--
DayName(mydate)

rsitem.MoveNext
Loop
%>

Then Dim array variables for day names

<%
Dim Mon,Tue,Wd,Thu,Fri,Sat,Sun

Now do i populate each array??

%>

I am unable to mix Vbscript and ASP and getting errors??

Please Suggest..

Thanks

-VJ
 
OK Drexor...sorry for the confusion in my previous post...

Here is what i have now...

Code:
<body>
<%
Function FindDate(DayVal,StartDate,FindBackward) ' findbackward is true/false to indicate direction from start to find first matching day
    StartDate = CDate(StartDate)
    If Not IsNumeric(DayVal) Then Exit Function
    DayVal = CInt(DayVal)
    On Error Resume Next
    If FindBackward Then
        For i = 1 To 8
            If WeekDay(StartDate - i, vbSunday) = DayVal Then
                FindDate = StartDate - i
                Exit Function
            End If
        Next
    Else
        For i = 0 To 6
            If WeekDay(StartDate + i, vbSunday) = DayVal Then
                FindDate = StartDate + i
                Exit Function
            End If
        Next
    End If
    FindDate = "Error"
End Function
%>
<%
Dim founddate

founddate=FindDate(1,now(),1)

Set rsitem = Server.CreateObject("ADODB.Recordset")
Set ObjConn = Server.CreateObject("ADODB.Connection")

ObjConn.Open strConnect

Sql = "SELECT * FROM cafemenu WHERE Menudate BETWEEN '"&foundate&"' AND '"&founddate+6&"' "

Set rsitem = ObjConn.Execute(Sql)
%>

My query works fine and i get all the values correctly... Now the only thing left is to display them into respective columns accordingly..

I am working on it...thought of posting this stage as my previous post was so confusing...

One more thing

When i response.Write founddate

i am getting the value as 6/20/2004 1:07:57 PM...how can i get only date and not the time..

Thanks

-VJ
 
Hi Drexor...

I am stuck at this point
Drexor said:
then you dim out 7 arrays ( monday, tuesday, etc ) founddate is your first array founddate+1 is your second array, as you loop through the recordset, you can either check against last used date or do a date difference and a case statement to push the value into the right array based on how many days difference there are.

I am not able to understand how to populate these 7 arrays looping through my recordset??

Any Suggestions..

-VJ
 
Hi Drexor...believe me or not...i finally completed the task and created my table... your description to achieve the task was very helpful...thanks a lot..

-VJ
 
will respond asap, running a little behind today, just want to touch base so you're not wondering what happened to me :)
 
One question though....

When i response.write founddate

i am getting it displayed as date and time like ...6/20/2004 1:07:57 PM

i just want it to be displayed as date

Any suggestions

-VJ
 
you can try using formatdatetime() for it, the way i normally remove extraneous time information is :

1.) (Now-(Now-date)) = Date, sounds redundant but effective, there's many instances where you have solid date formats and one extraneous datetime

2.) split it :) there's no spaces in date format, in datetime there's 2 one for the date/time separator and one for the AM/PM so date will always reside in yourarray(0) .... now there's exceptions to this military datetime mm:dd:yy:hh:mm:ss (icky) and other worldly formats which i dont know many of. (have to include the exceptions cause we're not all coding in america/canada)

3.) deconvert/reconvert datetimes when converted to strings "tend" to drop the time and become date only and can be reconverted back to date only.

4.) :) in the function calls you're using now(), why not use Date() ? :) no times on the end then ( poetic )

next post... helping with arrays... by the way, do you have a preference, fast yet possibly confusing to look at or, easier to understand for editing with a little performance cutback?

 
bear with me here, i'm not at a place where i can test the code : put additions/changes in bold

as for a prior question, finddate is 1:monday,2:tuesday etc.. startdate is whatever date range you need to feed it, and findbackwards is to look in a forewardly or backwardly direction from startdate so finddate(1,startdate,1) finds the first monday before startdate, finddate(2,startdate,0) finds the next tuesday after startdate, i was thinking this function might be benficial to you since you're basing your table and responses off of a week instead of arbitrary dates.

forewarning this is kind of halfway between "friendly" and "fast" so it might get a little confusing in the middle, feel free to ask questions to what each step does.

Code:
<body>
<%
' moved some of your code down so the DB connection isn't open as long

dayarrays = split("Monday,Tuesday,Wednesday,Thursday,Friday,Saturday,Sunday",",") ' this is for ease of dimming, reordering etc.
'part of the reasoning for this array will be more appearant later
for each dayarray in dayarrays
  execute("dim " & dayarray & "()") ' dynamically dims the dayarray variable as the variable's content as an array
next

' establishing your connection, recordset etc
Dim founddate
founddate=FindDate(1,Date(),1)

Set rsitem = Server.CreateObject("ADODB.Recordset")
Set ObjConn = Server.CreateObject("ADODB.Connection")
ObjConn.Open strConnect

Sql = "SELECT * FROM cafemenu WHERE Menudate BETWEEN '"&foundate&"' AND '"&founddate+6&"'[b] Order by menudate asc[/b]"

Set rsitem = ObjConn.Execute(Sql)

' these next few sections will be where it might get a little more confusing on you
' what's happening here is the dynamic determination of what weekday a menudate is on
' then adding the "BLAH" values to the day array, BLAH being an array of recordset items, the dish name, or whatever you're looking to store
' say the monday array, first slot
' using this way first of all cuts down on hoards of visible code, and lots of conditional statements
' like  determining if menudate is on a monday, then if/else add value to array, or proceed to determine if it's a tuesday etc

do while not rsitem.eof
  Execute(dayname(rsitem("menudate")) & " = AddToArray(" & dayname(rsitem("menudate")) & "," & BLAH & ")")    
  rsitem.movenext
Loop

'at this point we're done with the original data and using the arrays henceforth.
' so lets close and clear these buggers out 

set rsitem = nothing
objconn.close
set objconn = nothing

' this next cycle is similar to the one above, and in order to conditionally check the dynamics we'll need the exec statement again in order to plug in the array names via variable into function calls, namely ubound
' this is in order to determine the max number of records returned on any given day, that way you can cycle the output out properly

MaxCount = 0
for each dayarray in dayarrays
  Execute("if ubound(" & dayarray & ") > MaxCount Then MaxCount=Ubound(" & dayarray & ")")
next

' now that we have arrays populated with data, and know how big the biggest data array is, we can move on to putting it out on screen
' now earlier when i called the AddToArray in the exec statement
' i didn't bother with a conditional to determine if the array was already populated
' AddToArray will auto add onto the end, so the first position (0) of each of the weekdays will be empty 
' so we'll start at (1) just in case you notice the starting point of the for loop being (1) instead of (0)

' Lets start making output 
response.write "<table>" & vbcrlf
response.write "<tr>" & vbcrlf
'the vbcrlf is just for formatting in html view if you ever look at that

' writing out the column headers, the day names
for each dayarray in dayarrays
  response.Write "<td>" & dayarray & "</td>" & vbcrlf 
next

response.write "</tr>" & vbcrlf
Dim OutPut(0)
' Output will be a single position array to store the output for each row, just in case the data contained is larger than a string variable

'step thru all array posistions to the max
For i=1 to MaxCount
OutPut(0) = ""
' step thru each day for each array posistion step
  For each dayarray in dayarrays
    MaxRec = Execute("Ubound(" & dayarray & ")")
    If i <= MaxRec Then ' catching the arrays that are smaller than the biggest one, so you dont get a "subscript out of range" error
      TempVal = Execute(dayarray & "(" & i & ")")
      If TempVal <> "" Then
        OutPut(0) = OutPut(0) & "<td>" & TempVal & "</td>" & vbcrlf
      Else ' catches the empty ones
        OutPut(0) = OutPut(0) & "<td>&nbsp;</td>" & vbcrlf
      End If
    Else
      OutPut(0) = OutPut(0) & "<td>&nbsp;</td>" & vbcrlf
    End If
  Next
  Response.Write "<tr>" & vbcrlf & OutPut(0) & "</tr>" & vbcrlf ' this just adds the surrounding table row tags around this row of data
Next

response.write "</table>" & vbcrlf
%>

<%
' Functions sent to bottom to free visual space
Function FindDate(DayVal,StartDate,FindBackward) ' findbackward is true/false to indicate direction from start to find first matching day
    StartDate = CDate(StartDate)
    If Not IsNumeric(DayVal) Then Exit Function
    DayVal = CInt(DayVal)
    On Error Resume Next
    If FindBackward Then
        For i = 1 To 8
            If WeekDay(StartDate - i, vbSunday) = DayVal Then
                FindDate = StartDate - i
                Exit Function
            End If
        Next
    Else
        For i = 0 To 6
            If WeekDay(StartDate + i, vbSunday) = DayVal Then
                FindDate = StartDate + i
                Exit Function
            End If
        Next
    End If
    FindDate = "Error"
End Function

Function DayName(DateValue)
    If IsDate(DateValue) Then
        Select Case WeekDay(DateValue, vbMonday)
            Case 1
                DayName = "Monday"
            Case 2
                DayName = "Tuesday"
            Case 3
                DayName = "Wednesday"
            Case 4
                DayName = "Thursday"
            Case 5
                DayName = "Friday"
            Case 6
                DayName = "Saturday"
            Case 7
                DayName = "Sunday"
        End Select
    Else
        DayName = "Error"
    End If
End Function

' function snippet from thread333-863153
Function AddToArray(OriginArray,AddValue)
  If IsArray(OriginArray) Then
   NewDim = Ubound(OriginArray)+1
   ReDim Preserve OriginArray(NewDim)
   OriginArray(NewDim) = AddValue
   AddToArray = OriginArray
  Else
    AddToArray = Array(OriginArray,AddValue)
  End If
End Function

%>

as far as my estimate/math/guestimations are without being able to test this, it should about cover what you're after.

in a while i'll write up a more "user friendly" version with all the fieldnames/conditionals seperate weekdays etc..


DreX - aKa - Robert
 
looks like i forgot to add the bolding in most of it, sorry about that, was more concerned about getting you comments/documentation in there.

DreX - aKa - Robert
 
looks like i had a couple small quarks in the code from not having something to test it on, now that's i got it tested, here's the updated code.

now where i have rsitem("MenuItem") that's whatever value you want to show from that DB record

also i bolded up the most recent changes ( actually remembered it this time :) )

Code:
<%response.expires=0%>
<html>
<body>
<%
' moved some of your code down so the DB connection isn't open as long

dayarrays = split("Monday,Tuesday,Wednesday,Thursday,Friday,Saturday,Sunday",",") ' this is for ease of dimming, reordering etc.
'part of the reasoning for this array will be more appearant later
[b]
for each dayarray in dayarrays
  execute(dayarray & " = Array()") ' dynamically dims the dayarray variable as the variable's content as an array
next
[/b]
' establishing your connection, recordset etc
Dim founddate
[b]
founddate=FindDate(1,date(),1)
[/b]
Set rsitem = Server.CreateObject("ADODB.Recordset")
Set ObjConn = Server.CreateObject("ADODB.Connection")
strconnect = "dsn=menu;"
' [b] the strconnect value wasn't in there before, make sure you get it added/corrected[/b]
ObjConn.Open strConnect

Sql = "SELECT * FROM cafemenu WHERE menudate BETWEEN #" & founddate & "# AND #" & founddate+6 & "# Order by [now] asc"
'[b] PS there was a typo in the SQL string last time, it's founddate not foundate
' Please note the addition of #'s to the dates instead of single quotes
' if you're using ACCESS you need #'s
' if you're using SQL you'll need the single quotes[/b]
Set rsitem = ObjConn.Execute(Sql)

' these next few sections will be where it might get a little more confusing on you
' what's happening here is the dynamic determination of what weekday a menudate is on
' then adding the RSitem("menuitem") values to the day array, RSitem("menuitem") being an array of recordset items, the dish name, or whatever you're looking to store
' using this way first of all cuts down on hoards of visible code, and lots of conditional statements
' like  determining if menudate is on a monday, then if/else add value to array, or proceed to determine if it's a tuesday etc
[b]
do while not rsitem.eof
  Execute(dayname(rsitem("menudate")) & " = AddToArray(" & dayname(rsitem("menudate")) & ",""" & RSitem("menuitem") & """)")
  rsitem.movenext
Loop
[/b]
'at this point we're done with the original data and using the arrays henceforth.
' so lets close and clear these buggers out 
set rsitem = nothing
objconn.close
set objconn = nothing

' this next cycle is similar to the one above, and in order to conditionally check the dynamics we'll need the exec statement again in order to plug in the array names via variable into function calls, namely ubound
' this is in order to determine the max number of records returned on any given day, that way you can cycle the output out properly

MaxCount = 0
for each dayarray in dayarrays
  Execute("if ubound(" & dayarray & ") > MaxCount Then MaxCount=Ubound(" & dayarray & ")")
next

' now that we have arrays populated with data, and know how big the biggest data array is, we can move on to putting it out on screen
[b]' since there were changes to the handling of things, specifically the dimming of the arrays, the first slot is no longer empty, so we'll be starting the loops at (0) 
[/b]
' Lets start making output 
response.write "<table border=1>" & vbcrlf
response.write "<tr>" & vbcrlf
'the vbcrlf is just for formatting in html view if you ever look at that

' writing out the column headers, the day names
for each dayarray in dayarrays
  response.Write "<td>" & dayarray & "</td>" & vbcrlf 
next

response.write "</tr>" & vbcrlf
Dim OutPut(0)
' Output will be a single position array to store the output for each row, just in case the data contained is larger than a string variable

'step thru all array posistions to the max
[b]For i=0 to MaxCount[/b]
' step thru each day for each array posistion step
OutPut(0) = ""
  For each dayarray in dayarrays
    [b]Execute("MaxRec = Ubound(" & dayarray & ")")[/b]
    If i <= MaxRec Then ' catching the arrays that are smaller than the biggest one, so you dont get a "subscript out of range" error
[b]      Execute("TempVal = " & dayarray & "(" & i & ")")[/b]
      If TempVal <> "" Then
         OutPut(0) = OutPut(0) & "<td>" & TempVal & "</td>" & vbcrlf
      Else ' catches the empty ones
        OutPut(0) = OutPut(0) & "<td>&nbsp;</td>" & vbcrlf
      End If
    Else
      OutPut(0) = OutPut(0) & "<td>&nbsp;</td>" & vbcrlf
    End If
  Next
  Response.Write "<tr>" & vbcrlf & OutPut(0) & "</tr>" & vbcrlf ' this just adds the surrounding table row tags around this row of data
Next

response.write "</table>" & vbcrlf
%>
</body>
</html>
<%
' Functions sent to bottom to free visual space
Function FindDate(DayVal,StartDate,FindBackward) ' findbackward is true/false to indicate direction from start to find first matching day
    StartDate = CDate(StartDate)
    If Not IsNumeric(DayVal) Then Exit Function
    DayVal = CInt(DayVal)
    On Error Resume Next
    If FindBackward Then
        For i = 1 To 8
            If WeekDay(StartDate - i, vbSunday) = DayVal Then
                FindDate = StartDate - i
                Exit Function
            End If
        Next
    Else
        For i = 0 To 6
            If WeekDay(StartDate + i, vbSunday) = DayVal Then
                FindDate = StartDate + i
                Exit Function
            End If
        Next
    End If
    FindDate = "Error"
End Function

Function DayName(DateValue)
    If IsDate(DateValue) Then
        Select Case WeekDay(DateValue, vbMonday)
            Case 1
                DayName = "Monday"
            Case 2
                DayName = "Tuesday"
            Case 3
                DayName = "Wednesday"
            Case 4
                DayName = "Thursday"
            Case 5
                DayName = "Friday"
            Case 6
                DayName = "Saturday"
            Case 7
                DayName = "Sunday"
        End Select
    Else
        DayName = "Error"
    End If
End Function

' function snippet from Thread333-863153
Function AddToArray(OriginArray,AddValue)
  If IsArray(OriginArray) Then
   NewDim = Ubound(OriginArray)+1
   ReDim Preserve OriginArray(NewDim)
   OriginArray(NewDim) = AddValue
   AddToArray = OriginArray
  Else
    AddToArray = Array(OriginArray,AddValue)
  End If
End Function
%>

This should be functional on your side with a couple quick changes, speficically the strconnect and rsitem("menuitem") values and make note of the date qualifiers in the SQL string, make sure to update those to the corresponding ones to the datasource you're using.

let me know if there's any questions

<PS> did one last copy paste from this to myside, changed my datasource, tablename, and fieldnames, and it fired right off... you should be able to at least see some results quick </PS>

DreX - aKa - Robert
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top