Results 1 to 12 of 12
  1. #1
    RandyH is offline Novice
    Windows 7 64bit Access 2013 64bit
    Join Date
    Dec 2020
    Posts
    25

    Append Query

    I'm trying to run an Append Query where
    Records from [Style].[MatchString] are Appended to [New Billing].[New Style] with no duplicates in [New Billing].[New Style]

    INSERT INTO [New Billing] ( [New Style] )


    SELECT [New Billing].[New Style]
    FROM [New Billing] RIGHT JOIN Style ON [New Billing].[New Style] = Style.MatchString
    WHERE ((([New Billing].[New Style]) Is Null) AND ((Style.MatchString) Is Not Null));


    When I use the View Button it shows (doesn't actually show results), but does display the correct destination [New Billing].[New Style] and indicates 52,000+ records. When a run the Query I get this message. And 0 records are appended

    Job Tracking (name of my Program) can't append all the records in the append Query.
    Job Tracking set 0 fields to Null due to type conversion failure and didn't add 0 records...


    [New Billing].[New Style] is indexed, no duplicates. I have other Append Queries that appends what records are permitted and not the restricted ones. Although those Queries only handle a few hundred records at a time.

    Any Suggestions?
    Last edited by RandyH; 12-05-2020 at 05:31 PM. Reason: To see if it is even possible to append

  2. #2
    Micron is online now Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,793
    That message is generic and always includes all reasons why. Those with 0's don't apply (like the Null one). Those with other numbers apply so which condition applied for you?
    Or you can run this query in code and suppress warnings and it should append what records it can and bypass what it can't. You should code it so that if it errors you turn warnings back on with an error handler.

    The datasheet view of an action query will at least show the number of records to be affected (depending on what you're doing) so you could scroll down to see the record count if that will give you some clue. In your case that might be thousands of records though. Pretty sure your issue has nothing to do with the record count. The missing clue is which of the 4 (or is it 5?) parts of the message applies here. Could even be more than one reason.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  3. #3
    RandyH is offline Novice
    Windows 7 64bit Access 2013 64bit
    Join Date
    Dec 2020
    Posts
    25
    Thanks for your response. Not sure what you mean.
    " Or you can run this query in code and suppress warnings and it should append what records it can and bypass what it can't. You should code it so that if it errors you turn warnings back on with an error handler."

  4. #4
    Micron is online now Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,793
    Something like the following 'air code'
    Code:
    Sub RunQuery()
    Dim sSql As String
    Dim db As DAO.Database
    
    On Error GoTo errHandler
    
    Set db = CurrentDb
    sSql = "build/write action query sql statement here"
    Docmd.SetWarnings False
    db.Execute sSql, dbFailOnError
    
    exitHere:
    DoCmd.SetWarnings True
    Set db = Nothing
    Exit Sub
    
    errHandler:
    Msgbox "Error " & err.Number & ": " & err.Description
    Resume exitHere
    
    End Sub
    If your query raises an error and warnings were turned off, the error handler presents the message and control passes to the exitHere line label where warnings are turned back on. The message you got is a warning and setting SetWarnings to False should disable it. If you need to know how many records were appended, I believe the RecordsAffected property of the Execute method (db.Execute) will report updated as well as appended. Maybe verify that if you're concerned. Otherwise, the query sql should run and append 0 records or thousands but you wouldn't get a direct indication.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  5. #5
    orange's Avatar
    orange is online now Moderator
    Windows 10 Access 2016
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,722
    See this info re Insert into for samples.
    With Access it is better to not have embedded spaces in field or object names.

    Can you describe in plain English what you are trying to achieve?
    As requested in a previous post, could you tell us about the styles to help put your posts and database into context?

  6. #6
    RandyH is offline Novice
    Windows 7 64bit Access 2013 64bit
    Join Date
    Dec 2020
    Posts
    25
    My previous posts about style seem to have been solved with a modified Module written by John. I still testing that module and when convinced I will mark the post as solved.

    Appending the [Style].[MatchSting] to [New Billing].[New Style] is part of that process.

    In this post did you see any reason why my Append Query (above) is not working as expected?

    Thanks Orange!

  7. #7
    RandyH is offline Novice
    Windows 7 64bit Access 2013 64bit
    Join Date
    Dec 2020
    Posts
    25
    Going through the material you recommend it appears Access will only append records that have the same Column Name in both the Source and Destination Tables. And resists Appends when both the Source and Destination Tables have Columns that are the same name.

    I want to append [Style].[MatchString] to [New Billing].[New Style] even thought Tbl [New Billing] has a column [Matchstring]

    Please help!!!

  8. #8
    Micron is online now Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,793
    Please help!!!
    You can help others help to help you by answering the questions asked of you.
    Those with other numbers apply so which condition applied for you?
    .
    The missing clue is which of the 4 (or is it 5?) parts of the message applies here. Could even be more than one reason.
    I don't see the relevance of that link so I'll leave it to Orange to answer your questions re that. You can append **any value from any table from any field to any field in any table** regardless of names so I don't understand those comments.

    **subject to any constraints imposed by design - e.g. data types, field size, required or not, etc.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  9. #9
    RandyH is offline Novice
    Windows 7 64bit Access 2013 64bit
    Join Date
    Dec 2020
    Posts
    25
    Sorry, but what questions have I not answered?

    Sincerely,
    RandyH

  10. #10
    Micron is online now Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,793
    I just quoted them for you? Go back to my first post and you'll see I quoted from it.
    If you answered them I missed it but I've looked more than once.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  11. #11
    orange's Avatar
    orange is online now Moderator
    Windows 10 Access 2016
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,722
    We need to see your structure-- as requested.

    Can you describe in plain English what you are trying to achieve?
    As requested in a previous post, could you tell us about the styles to help put your posts and database into context?

  12. #12
    RandyH is offline Novice
    Windows 7 64bit Access 2013 64bit
    Join Date
    Dec 2020
    Posts
    25
    Changed Validation Rules and got it to work. Thanks

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

Similar Threads

  1. Replies: 19
    Last Post: 10-03-2017, 09:10 AM
  2. Replies: 1
    Last Post: 09-02-2015, 08:44 AM
  3. Access can't append all the records in the append query
    By fluffyvampirekitten in forum Access
    Replies: 2
    Last Post: 08-27-2015, 01:53 AM
  4. Replies: 1
    Last Post: 10-06-2011, 08:37 AM
  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