Access Database

Posted on 2004-11-21
Last Modified: 2010-05-02
Could someone tell me why this wont work? Thanks
It works with the first select statement, but it never selects anything with the second one.

    Set rsADO = New ADODB.Recordset
    rsADO.Open "SELECT `Client#` FROM JobFile WHERE `Invoice#`=" & Val(txtID.Text), conn
Set rsADO1 = New ADODB.Recordset
With rsADO
   Do Until .EOF
       For i = 0 To .Fields.Count - 1
            rsADO1.Open "SELECT `MailAddr`,`MailCity`,`STATE`,`Zip` FROM MAILING WHERE `Client#`=" & Val(.Fields(i).Value), conn
            With rsADO1
                Do Until .EOF
                    For j = 0 To .Fields.Count - 1
                        Print .Fields(j).Value
                    Next j
            End With
       Next i
End With
Question by:Snow-Storm
    LVL 12

    Accepted Solution

    Try removing the single quotes (') from the "field list" -- MailAddr, MailCity, State, Zip

    rsADO1.Open "SELECT MailAddr, MailCity, State, Zip FROM Mailing WHERE [Client#] = " & Val(.Fields(i).Value), conn
    LVL 1

    Expert Comment

    try to Jkaios commnts.

    Featured Post

    Top 6 Sources for Identifying Threat Actor TTPs

    Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

    Join & Write a Comment

    Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
    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…
    Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
    Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

    728 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

    Need Help in Real-Time?

    Connect with top rated Experts

    22 Experts available now in Live!

    Get 1:1 Help Now