Results 1 to 2 of 2
  1. #1
    carmenv323 is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Oct 2021
    Location
    Massachusetts
    Posts
    78

    If nothing to append then move on


    Hi All,

    In my afterupdate I have a code to update and append data from one table to another if data exists. I simply have an Insert Into sql in my code and then fire it off with db.execute strSQL, dbFailOnError where db is Dim db DAO.Database, Set db=CurrentDB.


    This works fine if there's something to update and append but if there's nothing in the table I get an error that there are too few parameters. I know that sql is good because it works otherwise, how can I get it to stop if data isn't found that matches the criteria?

  2. #2
    Gicu's Avatar
    Gicu is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,101
    Maybe try:
    Code:
    If dCount("*","tblYourSourceTable") >0 then 
        db.execute strSQL, dbFailOnError
    End If
    Vlad Cucinschi
    MS Access Developer
    http://forestbyte.com/

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 4
    Last Post: 02-03-2021, 08:32 AM
  2. Replies: 19
    Last Post: 10-03-2017, 09:10 AM
  3. Replies: 3
    Last Post: 12-11-2014, 11:26 AM
  4. Replies: 6
    Last Post: 03-29-2013, 02:51 PM
  5. Replies: 7
    Last Post: 07-21-2011, 01:01 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums