How many records affected by query?

Discussion in 'Access VBA Modules' started by OceansideDJ, Apr 12, 2004.

  1. OceansideDJ

    OceansideDJ Guest

    I have a button on a form that OnClick does DoCmd.OpenQuery...
    I want to turn off the warnings, but still report the number of records updated
    to the user. I am trying to use the RecordsAffected property with no luck so
    far.

    Thanks,

    Mike
     
    OceansideDJ, Apr 12, 2004
    #1
    1. Advertisements

  2. OceansideDJ

    Crystal Guest

    I think you need to use the db.Execute method with the
    RecordsAffected property. Convert your SQL statement into
    a string.

    Dim db as DAO.Database
    Dim strSQL as String

    Set db = CurrentDb

    strSQL = <sql statement goes here, converted to VBA>

    db.Execute strSQL
    MsgBox db.RecordsAffected

    Hope this helps,
    Crystal

    >-----Original Message-----
    >I have a button on a form that OnClick does

    DoCmd.OpenQuery...
    >I want to turn off the warnings, but still report the

    number of records updated
    >to the user. I am trying to use the RecordsAffected

    property with no luck so
    >far.
    >
    >Thanks,
    >
    >Mike
    >.
    >
     
    Crystal, Apr 12, 2004
    #2
    1. Advertisements

  3. OceansideDJ

    OceansideDJ Guest

    Crystal,
    Works great.

    Thanks,
    Mike
     
    OceansideDJ, Apr 12, 2004
    #3
  4. OceansideDJ

    dileeprajam

    Joined:
    Feb 28, 2012
    Messages:
    2
    Likes Received:
    0
    Hi i am using the same code but i am getting the ODBC call failed error. can any one help me why am i getting this error.

    Thank you in advance for your help.

    -Dileep
     
    dileeprajam, Sep 16, 2013
    #4
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. ChrisPapad

    Many to many relathionship filter?

    ChrisPapad, Jul 12, 2005, in forum: Access VBA Modules
    Replies:
    2
    Views:
    106
    ChrisPapad
    Jul 12, 2005
  2. Bill H.

    many to many

    Bill H., Oct 12, 2005, in forum: Access VBA Modules
    Replies:
    1
    Views:
    68
    Allen Browne
    Oct 12, 2005
  3. Douglas J. Steele

    What VBA Access 2000 code updates many-to-many relationships?

    Douglas J. Steele, Dec 20, 2005, in forum: Access VBA Modules
    Replies:
    3
    Views:
    84
  4. lowestbass

    Records affected by running by docmd.openquery

    lowestbass, Mar 23, 2006, in forum: Access VBA Modules
    Replies:
    1
    Views:
    193
    Allen Browne
    Mar 23, 2006
  5. EarlCPhillips

    Many-to-many-to-many

    EarlCPhillips, Aug 23, 2006, in forum: Access VBA Modules
    Replies:
    3
    Views:
    311
    Tim Ferguson
    Aug 24, 2006
  6. SLY

    Many to Many Relationships

    SLY, Oct 2, 2007, in forum: Access VBA Modules
    Replies:
    3
    Views:
    71
    Klatuu
    Oct 3, 2007
  7. Dave Nene

    Populating the many side of a 1 to Many relationship

    Dave Nene, Mar 3, 2008, in forum: Access VBA Modules
    Replies:
    2
    Views:
    99
    Dave Nene
    Mar 4, 2008
  8. Arnold Klapheck

    Many to Many Form

    Arnold Klapheck, Jun 17, 2008, in forum: Access VBA Modules
    Replies:
    1
    Views:
    72
    John W. Vinson
    Jun 18, 2008
Loading...