Page 2 of 2 FirstFirst 12
Results 16 to 23 of 23
  1. #16
    JoeM is offline VIP
    Windows XP Access 2007
    Join Date
    Jun 2012
    Posts
    3,904
    In between the quotes of your CurrentDB.Execute statement:



    Code:
    CurrentDb.Execute " paste code here ",dbFailOnError
    or another way is to set it equal to a variable and run it like this:

    Code:
    Dim mySQL as String
    mySQL " paste code here "
    DoCmd.RunSQL mySQL
    (You could also use a variable in the "CurrentDb.Execute" method).

  2. #17
    Marianna_Air is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Aug 2012
    Posts
    56
    where in the VBA do I put that second option you gave me above? is it an event procedure? like on click?

  3. #18
    JoeM is offline VIP
    Windows XP Access 2007
    Join Date
    Jun 2012
    Posts
    3,904
    where in the VBA do I put that second option you gave me above? is it an event procedure? like on click?
    You need to determine how and when you want this code to run. That will drive where you put it.

    For example, if you want to be able to control it manually, you could place a Command Button on a Form, and place the code in the Click button of the Form. Then it will run whenver you click that Button. Alternatively, you could automatically call the code when some event happens (like the opening of a certain form, or from another section of code, etc).

  4. #19
    Marianna_Air is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Aug 2012
    Posts
    56
    Hmmm, button sounds good, I have a new record button, can I put it in to that somehow?

    Code:
    Private Sub Command84_Click()
        MsgBox Me.NewRecord
    End Sub

  5. #20
    JoeM is offline VIP
    Windows XP Access 2007
    Join Date
    Jun 2012
    Posts
    3,904
    Just paste it under your "MsgBox" line.

  6. #21
    Marianna_Air is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Aug 2012
    Posts
    56
    That what I figured, but nothing happend. Not even an error and compile ran fine

    Code:
    Private Sub Command84_Click()
        MsgBox Me.NewRecord
     CurrentDb.Execute "UPDATE [Request for Quotes] SET [Request for Quotes].RequestforQuotesDescription = 'FULL CERTIFICATION OF MATERIALS, PROCESSES, 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, O'RINGS, PACKING, ETC.  MUST BE INDIVIDUALLY PACKAGED AND LABELED WITH CURE DATES PER APPLICABLE MIL STANDARDS.  ALSO, PLEASE NOTE ALL ADDITIONAL CHARGES THAT MAY APPLY FOR EXAMPLE FREIGHT, DRY ICE/TEMP RECORDERS, WEDGE CRACK TEST ALSO PLEASE QUOTE FOB CANTONMENT, FLORIDA.  THANK YOU.'", dbFailOnError
    End Sub

  7. #22
    JoeM is offline VIP
    Windows XP Access 2007
    Join Date
    Jun 2012
    Posts
    3,904
    Is the command button on a Bound or Unbound Form? It might be best to put it in a new Command Button (by itself) on an Unbound Form.

  8. #23
    Marianna_Air is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Aug 2012
    Posts
    56
    I went with a button on the form, not as seamless as I wanted, but it works

    Hey thanks for allll the HELP!!!
    Kevin

Page 2 of 2 FirstFirst 12
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