Function Sample

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • HTDon
    New Member
    • Jan 2009
    • 5

    Function Sample

    Hi all;

    I haven't used VBA much since 2007 and am having trouble building a function from a query in Access 2000. Can you point me to a simple function that does this? My current problem is that VBA doesn’t recognize what a Dynaset is in my Dim Statement. I am sure I will have other problems once I get past this so a sample would be the best solution.

    Here is what I got so far, it's not much I know.

    Function ObsQuery()
    Dim obs As Database, qdfQuery As QueryDef, Obsset As Dynaset
    End Function


    Next I hope to paste the SQL code from my access querys into "qdfQuery.s ql = xxxxxxxxxxxxxxx xx" xs being the SQL code.

    Thanks

    Don
  • mrmelvin
    New Member
    • Aug 2008
    • 4

    #2
    Dynaset is a type of recordset.

    Dim rs As Recordset
    Dim rstype As RecordsetTypeEn um
    Set rs = CurrentDb.OpenR ecordset("selec t * from table where id = 100", RecordsetTypeEn um.dbOpenDynase t)
    Dim str As String
    Do While Not rs.EOF
    str = rs("fieldname" )
    MsgBox (str)
    rs.MoveNext
    Loop

    Comment

    • HTDon
      New Member
      • Jan 2009
      • 5

      #3
      Thank You!

      You Mr. Melvin are a gentleman and a scholar!

      Don

      Comment

      Working...