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

Updating information on a FlexGrid

Status
Not open for further replies.

aos

MIS
Feb 28, 2002
20
US
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 = &quot;<|<Room Type |<Period |< Breakfast |< Room Only |<Single + Breakfast |< Single Room Only |< Child |< Infant &quot;

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 &quot;The recordset is empty. No records exist&quot;, vbInformbation, &quot;Information&quot;
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
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top