Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8605213
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T02:46:15+00:00 2026-06-12T02:46:15+00:00

The following code errors on the MsgBox cn.RecordsAffected line with: Arguments are of the

  • 0

The following code errors on the MsgBox cn.RecordsAffected line with:

Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another.

How can I successfully get the affected number of rows? This is for an Access 2003 project. I’d prefer to keep it in 2003 format, so if there’s another way to do this, that would be great. I’d like to not have to upgrade the entire project for the sake of this 1 function.

Private Sub Command21_Click()
On Error GoTo Err1:
    Dim cn As ADODB.Connection
    Set cn = New ADODB.Connection
    With cn
        .Provider = "SQL Native Client"
        .ConnectionString = "Server=myserver\myinstance;Database=mydb;Uid=myuser;Pwd=mypass;]"
        .Open
    End With

On Error GoTo Err2:
    cn.Execute "SELECT * INTO someschema.sometable FROM someschema.anothertable"
    MsgBox cn.RecordsAffected
    Exit Sub

Err1:
    MsgBox "Failed to connect to database!"
    Exit Sub

Err2:
    MsgBox Err.DESCRIPTION
    cn.Close

End Sub
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T02:46:16+00:00Added an answer on June 12, 2026 at 2:46 am

    ADODB.Connection does not have a RecordsAffected property. However, the Execute method returns the affected records as a ByRef argument [MSDN]:

    Dim recordsAffected As Long
    cn.Execute "SELECT * INTO someschema.sometable FROM someschema.anothertable", _
               recordsAffected
    MsgBox recordsAffected    
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm testing out crossroads.js and hasher.js together and the following code errors on the
i am using the following code to copy files from one folder to another...
The following code runs without any errors but doesn't actually delete anything: $update =
Consider following code: My problem is: 1) I can't seem to cast the errors
I keep getting fatal errors for the following code. What should I do to
I've been receiving errors with the following code below saying that the index is
I tried the following code. Although I don't get any errors, it did not
I have the following code (changed object names, so syntax/spelling errors ignore). public class
I'm confused about the errors generated by the following code . In Derived::doStuff, I
whenever I compile my code, I receive the following errors: error: constructor Player in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.