Jump to content

datagrid and adodc linking database to adodec and loading into datagrid


comcu

Recommended Posts

Hi,

 

Has anyone loaded a access data base into a data grid on a acad vba form?

 

I have done this with vb6 before and tried to replicte the same with acad but the data grid seems to be missing the 'datasource' propertie?

 

I have loaded the datagrid and adodc control and set the connection string and the control sourc but like i said the datagrid does not have a 'datasource' propertie?

 

Cheers for any help,

 

Col.

Link to comment
Share on other sites

I believe you would set that at runtime and not on the form. Here is an example I found..

 

strSQL = "SELECT NameLast, NameFirst, SomeMoney " & _
             " FROM tblMyTable_0 M0, MyTable_3 M3 " & _
             " WHERE M0.sysid = M3.sysid " & _
             " ORDER BY NameLast "
rs.Open strSQL)
With dGrid
   Set .DataSource = rs
   .Visible = True
   .Top = TopPosition
   .Left = LeftPosition
   .Height = HeightValue
   .Width = WidthValue
   .AllowArrows = True
   .AllowRowSizing = True
   .ColumnHeaders = True
   For intRefCol = lBound(arrCol) To uBound(arrCol)
       With .Columns(intRefCol)
           .Button = True
           .Width = arrRefDisplayColWidth(intRefCol)
           .Caption = arrRefDisplayHeading(intRefCol)
           k = arrRefFieldSeq(intRefCol)
           Select Case arrRefFieldXref(k)
               Case "SomeMoney"
                   .Alignment = dbgRight
                   .NumberFormat = "$#,###.00"
               Case else
                   .Alignment = dbgLeft
           End Select
       End With
   Next
   blnSortAsc = False
   .Refresh
End With

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...