Results 1 to 7 of 7

Thread: Simple Access code queries [resolved]

Threaded View

  1. #6

    Thread Starter
    Member
    Join Date
    Feb 2004
    Posts
    58
    EXCELLENT!!!! It all works perfectly! Thanks for the help, it was very much needed and is very much appreciated

    The working solution.......basically copied from the link above

    VB Code:
    1. Sub selectAll()
    2. Dim conDatabase As ADODB.Connection
    3. Dim rs As New ADODB.Recordset
    4. Dim cmdCommand As New ADODB.Command
    5. Dim sql As String
    6. Dim valueString As String
    7.  
    8.     valueString = ""
    9.     Set conDatabase = CurrentProject.Connection   'IS THIS CORRECT
    10.     Set cmdCommand.ActiveConnection = conDatabase 'IS THIS CORRECT?
    11.     cmdCommand.CommandType = adCmdText
    12.  
    13.     sql = "SELECT * FROM SIMs"
    14.     cmdCommand.CommandText = sql
    15.  
    16.     Set rs = cmdCommand.Execute
    17.  
    18.     Do While Not rs.EOF
    19.         valueString = ""
    20.        
    21.         valueString = rs.Fields("Network_Code").Value
    22.         valueString = valueString + ", " + rs.Fields("SIM_No").Value
    23.         MsgBox (valueString)
    24.         rs.MoveNext
    25.     Loop
    26.  
    27. End Sub
    Last edited by mr_tango; Apr 14th, 2004 at 08:40 AM.

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