View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips[_6_] Bob Phillips[_6_] is offline
external usenet poster
 
Posts: 11,272
Default Dynamic Controls (CheckBox) using VBA in Excel

Where do you want the checkboxes? Assuming beyind A & B

Sub Reterieve_data()
Dim strSQL As String
Dim strResult As String
Dim OraDynaSet As Object
Dim i As Integer
strSQL = "select ename, empno from emp"
Set OraDynaSet = objDataBase.DBCreateDynaset(strSQL, 0&)
If OraDynaSet.RecordCount 0 Then
'There were records retrieved
OraDynaSet.MoveFirst
For i = 1 To OraDynaSet.RecordCount
With ActiveSheet
.Cells(i, 2) = OraDynaSet.Fields(0).Value
.Cells(i, 3) = OraDynaSet.Fields(1).Value
.CheckBoxes.Add(Cells(i, "D").Left, Rows(i).Top, 126, 18).Select
Selection.Caption = "Y/N?"
Selection.OnAction = "Macro1"
.CheckBoxes.Add(Cells(i, "E").Left, Rows(i).Top, 126, 18).Select
Selection.Caption = "Y/N?"
Selection.OnAction = "Macro1"
End With
OraDynaSet.MoveNext
Next i
End If
End Sub






--

HTH

RP
(remove nothere from the email address if mailing direct)


"akkurup" wrote in
message ...

Hi Bob,

Here's the Code
In Here Iam Show the data in Column B and C.
I want to Provide a Checkbox In Column "A" for each row
I am Using Oracle OO4O driver for connecting to the database and
reterieve the data.


Sub Reterieve_data()
Dim strSQL As String
Dim strResult As String
Dim OraDynaSet As Object
Dim i As Integer
strSQL = "select ename, empno from emp"
Set OraDynaSet = objDataBase.DBCreateDynaset(strSQL, 0&)
If OraDynaSet.RecordCount 0 Then
'There were records retrieved
OraDynaSet.MoveFirst
For i = 1 To OraDynaSet.RecordCount
ActiveSheet.Cells(i, 2) = OraDynaSet.Fields(0).Value
ActiveSheet.Cells(i, 3) = OraDynaSet.Fields(1).Value
OraDynaSet.MoveNext
Next i
End If
End Sub


--
akkurup
------------------------------------------------------------------------
akkurup's Profile:

http://www.excelforum.com/member.php...o&userid=28316
View this thread: http://www.excelforum.com/showthread...hreadid=479030