Results 1 to 4 of 4

Thread: Handling Executed Queries

  1. #1

    Thread Starter
    New Member
    Join Date
    Aug 2001
    Location
    Gold Coast, Queensland.
    Posts
    6

    Exclamation Handling Executed Queries

    Hey All,

    I'm writing a VB App at the moment on a bit of a learning curve for my own benefit and have made a Mock Up Database and used the "DataEnviroment" to connect to it. I have done this all find and used the SQL Builder to make a query on the database and that worked great!

    One problem reside's.

    How can I get it so I can store the retrieved information to a variable or be written to another source? I know this is definately not one for the pros, and mock me if you like but it is of great inportence to find this out.

    Thankyou in advance for any help that is given,

    Jester

  2. #2
    Randalf the Red honeybee's Avatar
    Join Date
    Jun 2000
    Location
    off others' brains
    Posts
    4,345

    Well ...

    I think what you need is recordsets. Check out some ADO tutorials, MSDN help and the database section on this forum to learn more about it.

    .
    I am not a complete idiot. Some parts are still missing.
    Check out the rtf-help tutorial
    General VB Faq Thread
    Change is the only constant thing. I have not changed my signature in a long while and now it has started to stink!
    Get more power for your floppy disks. ; View honeybee's Elite Club:
    Use meaningfull thread titles. And add "[Resolved]" in the thread title when you have got a satisfactory response.
    And if that response was mine, please think about giving me a rep. I like to collect them!

  3. #3
    PowerPoster
    Join Date
    Jul 2001
    Location
    Tucson, AZ
    Posts
    2,166
    Following should help you. Once the query is performed then get the results as follows:

    VB Code:
    1. Sub Selected(qdfTemp As QueryDef)
    2.  
    3.    Dim rsTemp As Recordset
    4.    
    5. Set rsTemp = qdfTemp.OpenRecordset(dbOpenForwardOnly)
    6.    
    7.    'Enumerate recordset for found records
    8.    With rsTemp
    9.    
    10.       Do While Not .EOF
    11.      
    12.          'Get Values and assign to variables
    13.  
    14.          lngYourVariable = !fldName         'Used in Your SELECT
    15.  
    16.         .MoveNext
    17.       Loop
    18.  
    19.    End With
    20.  
    21.    rsTemp.Close
    22.    Set rsTemp = Nothing
    23.    
    24. End Sub

  4. #4

    Thread Starter
    New Member
    Join Date
    Aug 2001
    Location
    Gold Coast, Queensland.
    Posts
    6

    Cool Thanx!

    Thanks for replying, it means heaps!

    I will try all of your advice (I have already downloaded a tonne of help files from MSDN as I haven't got a copy of the CD .

    I am still going in to working with Database's with a bit of a blind eye so I still haven't learnt what I need to learn on Recordsets but I've always been a quick learner.

    Any on-going advice will be greatly appreciated.

    Jester.

Posting Permissions

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



Click Here to Expand Forum to Full Width