Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

emory only recordset bound to a grid?

Posted on 2000-03-15
2
Medium Priority
?
190 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 9

Accepted Solution

by:
samopal earned 200 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses

704 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