Visual Basic Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreVisual Basic Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old October 9th, 2003, 02:55 PM
ric ric is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2003
Location: Venice
Posts: 4 ric User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
MSFlexGrid, dates & other

HY, friends.

I have a database (data1.recordset) containing following relevant fields
shown within an MSFlexGrid:
.(“lastname”) ‘selfexplanatory
.(“arrivaldate”) as above
.(“departure”) as above
.(“roomno”) as number of room for an hotel

The row header shows dates for 365 days
The column header shows numbers of existing rooms

Now I need to fill the MSFlexGrid with lastnames into the proper dates/roomno cells
indicating the days a guest stay at the hotel.
To do so I have this code which have heavy problem and has to be remanipulated:

First of all loop in all records of data1
‘BEGIN
dim column as integer
dim row as integer
dim ind as integer


Data1.Recordset.MoveFirst

Do While Not Data1.Recordset.EOF

' looking for proper column (the date)
column = DateDiff(“d”,Data1.Recordset.Fields(“arrivaldate”), MSFlexGrid1.TextMatrix(0, 0))

' looking for proper row (the room number)
row = 0 ' row containing the cell to be filled

For ind = 1 To MSFlexGrid1.Rows
If MSFlexGrid1.TextMatrix(ind, 0) = Data1.Recordset.Fields(“roomno”) Then
row = ind
Exit For
End If
Next ind

' Filling the row of room with cells corresponding to days in which
‘client occupied it

For ind = 1 To DateDiff("d", Data1.Recordset.Fields(“arrivaldate”), Data1.Recordset.Fields(“departure”))
MSFlexGrid1.TextMatrix(row, column + ind - 1) = Data1.Recordset.Fields(“lastname”)
Next ind

Data1.Recordset.MoveNext
Loop
’END

I receive back error messages like: “interval not included …” … some “lastnames”
Appearing in the row headers, and so on.
This code has heavy problem.
Does anyone is so kind to suggest correction or a new one?
This will solve a vital problem and can’t by myself.
Thanks in advance.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreVisual Basic Programming > MSFlexGrid, dates & other


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway