The Forums on slxdeveloper.com are now retired. The forum archive will remain available for the time being. Thank you for your participation on slxdeveloper.com!
|
|
Checkbox on Dynamic Grid not Working..........
Posted: 30 Jan 08 12:56 PM
|
Hello all .....
I have a dynamic grid with a few fields on it....one of them being a checkbox field. The checkbox is not bound to any table fields....Will this work? |
|
|
| |
|
Re: Checkbox on Dynamic Grid not Working..........
Posted: 31 Jan 08 5:12 PM
|
So I am able to build the column as follows:
Set col = .Add(4) col.Caption = "Select" col.ReadOnly = False col.Width = 30
But no matter what I do the checkbox will not let me toggle. It just stays blank no matter how many times clicked. I thought it might have been due to being unbound from a field. Am I missing something?
Thanks,
JP |
|
|
| |
| |
|
Re: Checkbox on Dynamic Grid not Working..........
Posted: 01 Feb 08 9:45 AM
|
Setting the grid to sortable did not seem to work. As of now the CheckBox shows up but remains blank no matter what.....below is some of the code:
'Build Grid Dynamically Dim col Dim i Dim strSql
' Run SQL for search parameters With grdSearch strSql = "SELECT DISTINCT 'F' AS SLC, C.ACCOUNT, C.FULLNAME, C.CONTACTID FROM sysdba.CONTACT C JOIN ADDRESS A ON A.ENTITYID = C.ACCOUNTID WHERE NOT (C.CONTACTID IN(SELECT CONTACTID FROM sysdba.C_COMM_RECIPS WHERE C_COMMUNICATIONSID = '" & form.CurrentID & "'))" strSql = strSql & " AND C.FIRSTNAME LIKE '" & edtFirstName.Text & "%'" strSql = strSql & " AND C.LASTNAME LIKE '" & edtLastName.Text & "%'" strSql = strSql & " AND C.STATUS LIKE '" & pklStatus.Text & "%'" strSql = strSql & " AND C.ACCOUNT LIKE '" & edtCompany.Text & "%'" strSql = strSql & " AND A.CITY LIKE '" & edtCity.Text & "%'" strSql = strSql & " AND A.STATE LIKE '" & pklState.Text & "%'" If cbkPrimaryOnly.Text = "T" THEN strSql = strSql & " AND A.ISPRIMARY = 'T'" End If
.SQL.Text = strSql lblRecordsShown.Caption = "Results Found: " & grdSearch.Recordset.RecordCount With .Columns 'remove any existing columns If (.Count > 0) Then For i = 0 To .Count - 1 .Item(0).Delete Next End If
'add column for SELECT Set col = .Add(4) col.Caption = "Select" col.FIeldName = "slc" col.ReadOnly = False col.Width = 30
'add column for ACCOUNT field Set col = .Add(0) col.FieldName = "account" col.Caption = "Company" col.ReadOnly = True col.Width = 200
'add column for FULLNAME field Set col = .Add(0) col.FieldName = "fullname" col.Caption = "Contact" col.ReadOnly = True col.Width = 200
'add column for CONTACTID field Set col = .Add(0) col.FieldName = "contactid" col.Caption = "ContactID" col.Visible = False
End With 'now refresh the grid to see the new columns .Refresh End With
Thanks,
JP |
|
|
|
Re: Checkbox on Dynamic Grid not Working..........
Posted: 01 Feb 08 6:25 PM
|
I think that building the recordset that way may make the Recordset a forward only one so it is therefore read-only.
Try this:
(Do this anyway) - remove the "sysdba." from your SQL, they are not necessary.
Dim rs Set rs = CreateObject("ADODB.Recordset") rs.CursorLocation = 3
rs.Open txtQuery.value, cn, 3, 4
Set DataGrid1.Recordset = rs
You will be able to check on bound check boxes then. So you need to use a field to store your check answers.
Also, this will probably need a .UpdateBatch call to write back to the database if you need that.
Stephen
|
|
|
|