Results 1 to 10 of 10
  1. #1
    Join Date
    Sep 2004
    Posts
    16

    Red face Unanswered: Adding fields to DAO recordset

    I have a DAO recordset, and need to add some fields/columns to this recordset.

    How do I do this?

    Have tried to search this forum without any luck.

  2. #2
    Join Date
    Sep 2003
    Location
    MI
    Posts
    3,713
    Quote Originally Posted by Posan
    I have a DAO recordset, and need to add some fields/columns to this recordset.

    How do I do this?

    Have tried to search this forum without any luck.
    You can't just "add" columns ... Yuo have to query for them as part of the recordset ... How many fields and what type?
    Back to Access ... ADO is not the way to go for speed ...

  3. #3
    Join Date
    Sep 2004
    Posts
    16
    I do have only one field of type TEXT. This field is "Engineer_ID".
    I need two fields in addition. The content in this two new fields are made from calling some selfmade functions.

    Som my idea was to loop through all the "Engineer_ID" and calculate the contents in the two new fields.

    Then set this recordset as the recordsource to a report.

  4. #4
    Join Date
    Sep 2003
    Location
    MI
    Posts
    3,713
    Quote Originally Posted by Posan
    I do have only one field of type TEXT. This field is "Engineer_ID".
    I need two fields in addition. The content in this two new fields are made from calling some selfmade functions.

    Som my idea was to loop through all the "Engineer_ID" and calculate the contents in the two new fields.

    Then set this recordset as the recordsource to a report.
    Then you do that as part of your query ... With the QBE, it's called an expression ...
    Back to Access ... ADO is not the way to go for speed ...

  5. #5
    Join Date
    Dec 2002
    Location
    Préverenges, Switzerland
    Posts
    3,740
    don't forget to declare your selfmade functions Public in a form that will be open when the query/report runs (or Public in a module)

    izy
    currently using SS 2008R2

  6. #6
    Join Date
    Sep 2004
    Posts
    16
    thx, for your replies, but what is QBE?

  7. #7
    Join Date
    Feb 2004
    Location
    Chicago, IL
    Posts
    1,312
    It is the query design tool in Access. Create a new query, then add the appropriate table. Then add the Engineer_ID field and then add two calculated fields. Type something like:

    FieldName:FunctionName(AnyParameters)

    For example, to calculate the length of the Name field I would do soemthing like:

    NameLength:Len([Name])

    Then when you run the query you will see numbers in the column that is named NameLength.

  8. #8
    Join Date
    Sep 2004
    Posts
    16
    Yes, that is what my query does look like today.
    But this is to slow, and I'm working on making this with DAO recordsets.
    Then I lookup in the DAO recordsets instead of the table on each query record.

  9. #9
    Join Date
    Feb 2004
    Location
    Chicago, IL
    Posts
    1,312
    A recordset is nothing more than a variable for a table or query. I think you are barking up the wrong tree. To improve the speed of the query you might want to see if you can speed up the functions you wrote. How slow is the query now? Does it take seconds, minutes to run? Maybe if you posted the functions someone can help you optimize them.

  10. #10
    Join Date
    Sep 2004
    Posts
    16
    Thanx, The query was about 6 minutes. (When run lokally on a laptop)
    The functions are made with recordsets, and its now only 12 seconds.
    (about a minute on the network)

    I have now been able to make a DAO recordset with two empty fields.
    So now I'm on the track.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •