samantha72
Programmer
I populated a dbgrid via a stored procedure.
my grid looks like this
name type desc
aaa 0 ddddddddd
bbb 1 eeeeeee
i want to loop through this grid and replace the type column if 0 then
form and if 1 then Memo
I am unable to do this as i keep getting errors such as column.text is read only
this is how i am trying to loop
With cmdKits
.ActiveConnection = mcnnDB
.CommandText = "DisplayKits_Forms_pr"
.CommandType = adCmdStoredProc
.Parameters.Append cmdKits.CreateParameter("Language", adTinyInt, adParamInput, 1, giLang)
End With
rskits.CursorLocation = adUseClient
rskits.Open cmdKits, , adOpenKeyset, adLockReadOnly
Set frmOrder.dbgKits.DataSource = rskits
call kitorform
this is how i populate the grid
'This procedure loops through the grid and replaces the
'1 or 0 with the work Form or Kit
Private Sub DisplayKitorForm()
Dim iRowIdx As Integer
For iRowIdx = 0 To dbgKits.ApproxCount - 1 Step 1
' 'show form in the cell
If dbgKits.Columns(1).Text = 1 Then
dbgKits.Columns(1) = "Form"
Else
'show memo in the cell
dbgKits.Columns(1).Text = "Memo"
End If
Next
please help me out . Thanks
my grid looks like this
name type desc
aaa 0 ddddddddd
bbb 1 eeeeeee
i want to loop through this grid and replace the type column if 0 then
form and if 1 then Memo
I am unable to do this as i keep getting errors such as column.text is read only
this is how i am trying to loop
With cmdKits
.ActiveConnection = mcnnDB
.CommandText = "DisplayKits_Forms_pr"
.CommandType = adCmdStoredProc
.Parameters.Append cmdKits.CreateParameter("Language", adTinyInt, adParamInput, 1, giLang)
End With
rskits.CursorLocation = adUseClient
rskits.Open cmdKits, , adOpenKeyset, adLockReadOnly
Set frmOrder.dbgKits.DataSource = rskits
call kitorform
this is how i populate the grid
'This procedure loops through the grid and replaces the
'1 or 0 with the work Form or Kit
Private Sub DisplayKitorForm()
Dim iRowIdx As Integer
For iRowIdx = 0 To dbgKits.ApproxCount - 1 Step 1
' 'show form in the cell
If dbgKits.Columns(1).Text = 1 Then
dbgKits.Columns(1) = "Form"
Else
'show memo in the cell
dbgKits.Columns(1).Text = "Memo"
End If
Next
please help me out . Thanks