Page 1 of 2 12 LastLast
Results 1 to 15 of 23
  1. #1
    Marianna_Air is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Aug 2012
    Posts
    56

    Duplicate Comment into all records

    Can anyone tell me how to duplicate a comment that will be the same on all records. Right now I have to copy and paste the comment into the comment block of each record.



    Thanks

  2. #2
    JoeM is offline VIP
    Windows XP Access 2007
    Join Date
    Jun 2012
    Posts
    3,904
    Have a look at using an Update Query. Access built-in help files can help you create one.

  3. #3
    Marianna_Air is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Aug 2012
    Posts
    56
    Thanks, I'm going to take a different approach. I think I'm going to have the note be a part of the email I'm generating to send the report out on

  4. #4
    Missinglinq's Avatar
    Missinglinq is online now VIP
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Location
    Richmond (Virginia, not North Yorkshire!)
    Posts
    3,018
    Just so that you know, a simple Update Query, like this, really is simple!

    Just execute this statement in code:

    Code:
    Currentdb.Execute "UPDATE YourTableName SET CommentFieldName = 'Whatever your comment is'", dbFailOnError


    If it's a one time thing, you can do it from behind a temporary Command Button, or simply go into the Code Module of any Form, enter the line in the Immediate Window (<Ctrl> + <G>) and hit <Enter>.

    Linq ;0)>
    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

  5. #5
    Marianna_Air is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Aug 2012
    Posts
    56
    I'm going to use this, just not for the email message, I do have a note that needs to be in the body of the report itself that I will use this code for

    Thanks again, this will be very helpful to me

    Kevin

  6. #6
    Missinglinq's Avatar
    Missinglinq is online now VIP
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Location
    Richmond (Virginia, not North Yorkshire!)
    Posts
    3,018
    Glad we could help!

    Purely out of curiosity (I have way too much time on my hands!) is the Marianna_Air in your handle related to the facility that rehabs C5 Galaxies for the Air Force?

    Linq ;0)>
    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

  7. #7
    Marianna_Air is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Aug 2012
    Posts
    56
    Yes it is, funny that you know that, I never heard of the company until I submitted my resume for a job opening about 4 months ago, and I've been in this business for about 20 years 10 of them with Lockheed Martin

  8. #8
    Marianna_Air is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Aug 2012
    Posts
    56
    Ok, I must have something wrong in my code, can't get it to run correctly

    Code:
    CurrentDb.Execute "UPDATE Request For Quotes SET RequestforQuotesDescription = 'FULL CERTIFICATION OF MATERIALSPROCESSES, FINISHES, TESTS AND DIMENSIONAL INSPECTION DATA (AS APPLICABLE) AND CERTIFICATE OF CONFORMANCE MUST BE PROVIDED FOR INSPECTION.  ALL SHELF-LIFE LIMITED MATERIALS MUST HAVE AT LEAST 75% OF SHELF-LIFE REMAINING AT TIME OF DELIVERY.  MSDS IS REQUIRED WITH ALL CHEMICALS, SEALS, GASKETS, ORINGS, PACKING, ETC.  MUST BE INDIVIDUALLY PACKAGED AND LABELED WITH CURE DATES PER APPLICABLE MIL STANDARDS.  ALSO, PLEASE NOTE ALL ADDITIONAL CHARGES THAT MAY APPLY.  PLEASE QUOTE FOB CANTONMENT, FLORIDA.  THANK YOU.'", dbFailOnError

  9. #9
    JoeM is offline VIP
    Windows XP Access 2007
    Join Date
    Jun 2012
    Posts
    3,904
    For one thing, if "Request for Quotes" is your table name and contains spaces, it must be put in square brackets, i.e.
    Code:
    CurrentDb.Execute "UPDATE [Request for Quotes] SET ..."

  10. #10
    Missinglinq's Avatar
    Missinglinq is online now VIP
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Location
    Richmond (Virginia, not North Yorkshire!)
    Posts
    3,018
    JoeM's guess would be my bet, as well!

    Linq ;0)>
    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

  11. #11
    Marianna_Air is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Aug 2012
    Posts
    56
    That helped a little, thanks
    Now I'm getting a new error 3075 missing operator in query expression

  12. #12
    JoeM is offline VIP
    Windows XP Access 2007
    Join Date
    Jun 2012
    Posts
    3,904
    I always recommend creating the Update Query in Query Builder first and testing it out. When you have it working the way you want, they you can change it to SQL view and copy and paste the code to VBA.

    Also, what is the data type of the "RequestforQuotesDescription" field? Is it a "Memo" field?

  13. #13
    Marianna_Air is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Aug 2012
    Posts
    56
    Yes, it's a memo field,

    I want this memo to show on all records, old and new

    Maybe I need to take a different approach?

  14. #14
    JoeM is offline VIP
    Windows XP Access 2007
    Join Date
    Jun 2012
    Posts
    3,904
    Did you try building your Update Query in Query Builder and running it (in a test copy of your database), to see if it works, and if it does copying the SQL code from it into VBA (to ensure you have all your syntax correct)?

  15. #15
    Marianna_Air is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Aug 2012
    Posts
    56
    I did do that, and it works, but now I'm not smart enough to figure out were I need to paste it in my VBA
    I pasted it to the immidiate window and hit enter to test it not sure if thats correct but I got an error "compile error: excpected end of statement"

Page 1 of 2 12 LastLast
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Looking for VBA code to duplicate records
    By P38 in forum Programming
    Replies: 4
    Last Post: 08-01-2012, 07:25 PM
  2. Duplicate records listed!
    By claysea in forum Access
    Replies: 3
    Last Post: 02-14-2012, 12:33 PM
  3. preventing duplicate records
    By Alliana Gray in forum Access
    Replies: 6
    Last Post: 08-11-2011, 01:18 PM
  4. Duplicate Records
    By softspoken in forum Queries
    Replies: 3
    Last Post: 06-21-2010, 03:33 PM
  5. Delete duplicate records
    By Zukster in forum Queries
    Replies: 1
    Last Post: 08-26-2009, 03:14 AM

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