2 Queries...???

  • ok i have a button on my Form that clears all 'old' calls and puts them into an 'old calls' table. This button works fine, and here is the code:

    Option Compare Database

    Private Sub cmdDelete_Click()

        With DoCmd

            .SetWarnings False

            .OpenQuery "x"

            .OpenQuery "xx"

            .SetWarnings True

        End With

    End Sub

    Private Sub cmdDelete1_Click()

    End Sub

    ('x' is first query, 'xx' is second)

    However, i want another identical button which clears 'old' records out of another form and places them in a different table....BUT the button does not work. the queries work when i run them seperatley, however they dont work when i put them into code like the one above.....

    I thought the code should look like this:

    Option Compare Database

    Private Sub cmdDelete_Click()

        With DoCmd

            .SetWarnings False

            .OpenQuery "xxx"

            .OpenQuery "xxxx"

            .SetWarnings True

        End With

    End Sub

    Private Sub cmdDelete1_Click()

    End Sub

    ('xxx' is first query, 'xxxx' is second)

     

    Any Ideas??

    Thanks In Advance!

     

  • There are several possible reasons for this. You say that it doesn't work, but that can mean different things. What error message is returned from your code?

     

    George

  • rewrite as

    docmd.setwarnings false

    docmd.openquery "xxx"

    docmd.openquery "xxx"

    docmd.setwarnings true

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply