Results 1 to 6 of 6
  1. #1
    ick64 is offline Novice
    Windows 10 Access 2016
    Join Date
    Oct 2017
    Posts
    22

    SQL Update in Access Vba runs ok - but prompts for inputboxes

    Hello all,



    By adding the code below in the afterupdate event of a field in a form I get to update the record I need.

    However, instead of using the data I provided to do the update, Access prompts inputboxes for each one of the variables (i.e. Me.DataEmissao and Me.NumSolic).

    SQL ="UPDATE tabSolic_Orcamento "& _
    "SET tabSolic_Orcamento.DataEnvio = Me.DataEmissao "& _
    "WHERE ((tabSolic_Orcamento.Código = Me.NumSolic)) "

    Any tips?


    Thank you!

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    You have to concatenate:

    "SET tabSolic_Orcamento.DataEnvio = " & Me.DataEmissao & _

    If the data type is text or date/time, you need the appropriate delimiters around the value (' or #).
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    ick64 is offline Novice
    Windows 10 Access 2016
    Join Date
    Oct 2017
    Posts
    22
    Thank you pbaldy - it worked great!

    Just one final issue.. I use the date in the dd/mm/yyyy format but it is passed on to the record as mm/dd/yyyy. How can I adjust the date format?

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    You have to format the "correct" way.

    http://allenbrowne.com/ser-36.html#Format
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    ick64 is offline Novice
    Windows 10 Access 2016
    Join Date
    Oct 2017
    Posts
    22
    Thanks again pbaldy - after checking the link, the scropt now is running perfectly!

  6. #6
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Excellent, happy to help!
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

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

Similar Threads

  1. ADOB - Update runs very slow
    By fluffyvampirekitten in forum Access
    Replies: 2
    Last Post: 01-31-2016, 07:59 PM
  2. Replies: 7
    Last Post: 10-31-2014, 02:29 PM
  3. Replies: 4
    Last Post: 10-13-2014, 12:22 AM
  4. Replies: 2
    Last Post: 11-19-2012, 03:23 AM
  5. Replies: 1
    Last Post: 06-02-2010, 10:05 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