Results 1 to 9 of 9
  1. #1
    BorisGomel is offline Competent Performer
    Windows Vista Access 2003
    Join Date
    Apr 2011
    Posts
    101

    Can nnot update

    Hello,

    I am stack a bit here. I have a table called NANFINAL and in where I am trying to update the filed called InvoiceNumberQB with two criterias that are DateRemit and Code throught the form . I placed the form called Updateinvoice and put there three text boxes:txtInvoice,txtCode and txtDate and command button . In command button click event I typed code the below:

    Dim strSQL
    strSQL = "UPDATE NANFINAL " _
    & "SET InvoiceNumberQB = " & Forms!UpdateInvoices.txtInvoices & "" _
    & "Where Code = " & Forms!UpdateInvoices.txtCode & ""
    & " Where remitDate = #" & Form!UpdateInvoices.txtDate & "#"

    Access doesn't bug it as a mistake , but updating is not working .
    Can somebody point me out what probelm is here.
    Thank you in advance,


    The Best Reagrds,
    BorisGomel

  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,642
    Do you execute it? See if this helps:

    http://www.baldyweb.com/ImmediateWindow.htm

    You can't have to WHERE clauses. You separate the two conditions with And.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,642
    Oh, and you don't have line continuation characters on one of the lines.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  4. #4
    BorisGomel is offline Competent Performer
    Windows Vista Access 2003
    Join Date
    Apr 2011
    Posts
    101

    can not upadte

    Thank you !!
    I have rewritten code :

    Dim strSQL As String
    strSQL = "UPDATE NANFINAL " _
    & "SET InvoiceNumberQB = & Forms!UpdateInvoices.txtInvoices & " _
    & "WHERE Code = & Forms!UpdateInvoices.txtCode & " _
    & "AND DateOfProcessed = #" & Forms!UpdateInvoices.txtCode & "#"
    CurrentDb.Execute strSQL

    Still doesn't work.
    Thank you in advance.
    The Best Regards.
    BorisGomel

  5. #5
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,642
    What were the results of the Debug.Print?

    Your quotes were better before.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  6. #6
    BorisGomel is offline Competent Performer
    Windows Vista Access 2003
    Join Date
    Apr 2011
    Posts
    101

    CAN NOT update

    Here. Access debugs this mistake.
    I have revewed code and it seems ok.

    Run-time error "3075"
    Syntax error (missing operator) in query expression ' & Forms!UpdateInvoices.txtInvoices &'

    Thank you.

  7. #7
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,642
    Here's your code before (correct) and later (wrong):

    & "SET InvoiceNumberQB = " & Forms!UpdateInvoices.txtInvoices & "" _
    & "SET InvoiceNumberQB = & Forms!UpdateInvoices.txtInvoices & " _

    See the difference? You did it again below that.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  8. #8
    BorisGomel is offline Competent Performer
    Windows Vista Access 2003
    Join Date
    Apr 2011
    Posts
    101

    CAN NOT update

    Thank you so much !!
    Now it is working prefectly.
    A thousand thanks!!!
    BorisGomel

  9. #9
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,642
    Glad we got it sorted out!
    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. Replies: 4
    Last Post: 11-10-2011, 03:41 PM
  2. Replies: 1
    Last Post: 08-19-2011, 12:16 PM
  3. Replies: 1
    Last Post: 01-22-2011, 12:23 PM
  4. Update field in table after update on a subform
    By jpkeller55 in forum Queries
    Replies: 3
    Last Post: 09-30-2010, 08:02 PM
  5. Update Query- selective update?
    By stephenaa5 in forum Queries
    Replies: 1
    Last Post: 10-29-2009, 11:15 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