Solved

emory only recordset bound to a grid?

Posted on 2000-03-15
2
187 Views
Last Modified: 2011-08-18
I got the following code this morning and it is working perfectly:

  Dim r As ADODB.Recordset
   
  Set r = New ADODB.Recordset
  r.CursorLocation = adUseClient
   
  r.Fields.Append "IntegerField", adInteger
  r.Fields.Append "StringField", adVarChar, 30
  r.Fields.Append "DateField", adDate
   
  r.Open
   
  r.AddNew
  r.Fields("IntegerField").Value = 3
  r.Fields("StringField").Value = "It Works"
  r.Update
   
 
I am rather new to this so if this questions sounds silly, I apologize <g> I am able to populate the recordset but now I would like to present it to the user. I have tried setting the datasource or recordsource of a datagrid control to "r" but it rejects that. Can someone clear this up for me. I thought r was a recordset object and should be useable
0
Comment
Question by:scotts27
2 Comments
 
LVL 9

Accepted Solution

by:
samopal earned 50 total points
ID: 2621333
Just add this lines

    Set DataGrid1.DataSource = r
    DataGrid1.Columns(0).DataField = r.Fields(0).Name
    DataGrid1.Columns(1).DataField = r.Fields(1).Name
    DataGrid1.Columns(2).DataField = r.Fields(2).Name
   
    DataGrid1.ReBind

HTH
0
 

Author Comment

by:scotts27
ID: 2621350
Thanks! I was so close. I did not have it using the set syntax. I was just oing an assignmentt
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…

685 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question