Hi!
I want to update information on a flex grid. Is there any way, that i can click on the cell that i want to update and assign it a new value, someway of overwriting the old value?
Thanks!
The current code behind the grid is as follows:
Private Sub cboRmNo_Click()
Dim strrmno As String
RatesGrid.Clear
strrmno = cboRmNo.ListIndex + 1
Dim adoconnection As ADODB.Connection
Set adoconnection = New ADODB.Connection
adoconnection.Open ("Provider=Microsoft.jet.oledb.4.0;" & "Data Source = H:\IS4401Project\db.mdb"
Set rs1 = New ADODB.Recordset
rs1.Open "SELECT RatePeriods.RoomType, RatePeriods.PeriodID, RatePeriods.EnsuiteBfst, RatePeriods.EnsuiteSingleBfst, RatePeriods.EnsuiteRO, RatePeriods.EnsuiteSingleRO, RatePeriods.Child, RatePeriods.Infant, Room.RoomNo FROM Room INNER JOIN RatePeriods ON Room.RoomNo = RatePeriods.RoomNo WHERE [RatePeriods].[RoomNo]='" & strrmno & "' order by Room.RoomNo", adoconnection, adOpenDynamic, adLockOptimistic
RatesGrid.FormatString = "<|<Room Type |<Period |< Breakfast |< Room Only |<Single + Breakfast |< Single Room Only |< Child |< Infant "
Dim introw As Integer
Dim rows As Integer
With RatesGrid
rows = 1
rs1.MoveFirst
While Not rs1.EOF
rows = rows + 1
rs1.MoveNext
Wend
.rows = rows
.Cols = 9
introw = 1
If rs1.BOF Then
MsgBox "The recordset is empty. No records exist", vbInformbation, "Information"
Else
rs1.MoveFirst
While Not rs1.EOF
RatesGrid.TextMatrix(introw, 1) = rs1!RoomType
RatesGrid.TextMatrix(introw, 2) = rs1!PeriodID
RatesGrid.TextMatrix(introw, 3) = rs1!EnsuiteBfst
RatesGrid.TextMatrix(introw, 4) = rs1!EnsuiteSingleBfst
RatesGrid.TextMatrix(introw, 5) = rs1!EnsuiteRO
RatesGrid.TextMatrix(introw, 6) = rs1!EnsuiteSingleRO
RatesGrid.TextMatrix(introw, 7) = rs1!Child
RatesGrid.TextMatrix(introw, 8) = rs1!Infant
rs1.MoveNext
introw = introw + 1
Wend
Set rs1 = Nothing
End If
End With
End Sub
I want to update information on a flex grid. Is there any way, that i can click on the cell that i want to update and assign it a new value, someway of overwriting the old value?
Thanks!
The current code behind the grid is as follows:
Private Sub cboRmNo_Click()
Dim strrmno As String
RatesGrid.Clear
strrmno = cboRmNo.ListIndex + 1
Dim adoconnection As ADODB.Connection
Set adoconnection = New ADODB.Connection
adoconnection.Open ("Provider=Microsoft.jet.oledb.4.0;" & "Data Source = H:\IS4401Project\db.mdb"
Set rs1 = New ADODB.Recordset
rs1.Open "SELECT RatePeriods.RoomType, RatePeriods.PeriodID, RatePeriods.EnsuiteBfst, RatePeriods.EnsuiteSingleBfst, RatePeriods.EnsuiteRO, RatePeriods.EnsuiteSingleRO, RatePeriods.Child, RatePeriods.Infant, Room.RoomNo FROM Room INNER JOIN RatePeriods ON Room.RoomNo = RatePeriods.RoomNo WHERE [RatePeriods].[RoomNo]='" & strrmno & "' order by Room.RoomNo", adoconnection, adOpenDynamic, adLockOptimistic
RatesGrid.FormatString = "<|<Room Type |<Period |< Breakfast |< Room Only |<Single + Breakfast |< Single Room Only |< Child |< Infant "
Dim introw As Integer
Dim rows As Integer
With RatesGrid
rows = 1
rs1.MoveFirst
While Not rs1.EOF
rows = rows + 1
rs1.MoveNext
Wend
.rows = rows
.Cols = 9
introw = 1
If rs1.BOF Then
MsgBox "The recordset is empty. No records exist", vbInformbation, "Information"
Else
rs1.MoveFirst
While Not rs1.EOF
RatesGrid.TextMatrix(introw, 1) = rs1!RoomType
RatesGrid.TextMatrix(introw, 2) = rs1!PeriodID
RatesGrid.TextMatrix(introw, 3) = rs1!EnsuiteBfst
RatesGrid.TextMatrix(introw, 4) = rs1!EnsuiteSingleBfst
RatesGrid.TextMatrix(introw, 5) = rs1!EnsuiteRO
RatesGrid.TextMatrix(introw, 6) = rs1!EnsuiteSingleRO
RatesGrid.TextMatrix(introw, 7) = rs1!Child
RatesGrid.TextMatrix(introw, 8) = rs1!Infant
rs1.MoveNext
introw = introw + 1
Wend
Set rs1 = Nothing
End If
End With
End Sub