|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
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. |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > Visual Basic Programming > MSFlexGrid, dates & other |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|