Page 2 of 2 FirstFirst 12
Results 16 to 24 of 24
  1. #16
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,896
    Remove the comma in front of FROM, need a space in front of FROM.

    Don't need to concatenate empty string - two quote marks with nothing between them.

    Really should save customer ID instead of customer name, probably same for items.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  2. #17
    Mehvan's Avatar
    Mehvan is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Sep 2016
    Posts
    133
    Thanks a lot for your advice , I did what you said me
    but this time gave me this problem :

    Click image for larger version. 

Name:	Capture.PNG 
Views:	19 
Size:	21.2 KB 
ID:	35682

  3. #18
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,896
    In post 16 "need a space in front of FROM." See the syntax error where 44 runs into FROM. There is no space in front of FROM. Instead of "FROM should be " FROM.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  4. #19
    Mehvan's Avatar
    Mehvan is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Sep 2016
    Posts
    133
    sorry , these two days I was far for using network
    I did what you said , but also gave the same problem

    this is attachment :

    Update.zip

  5. #20
    GinaWhipp's Avatar
    GinaWhipp is offline Competent Performer
    Windows 7 64bit Access 2013 32bit
    Join Date
    Jul 2011
    Location
    Ohio, USA
    Posts
    377
    Umm, what exactly are you trying to do because that code snippet is not going to work. It looks like you want to update the values from from the Form to the Details table. If that is true then the FROM line is confusing the issue. Just use the values in the controls on the Form, i.e.

    Code:
    UPDATE Details SET Details.ID = " & Me.SaleID & ", Details.sDate = " & Me.SaleDate & ", Details.CustomerName = '" & Me.CustName & "', Details.ItemsName = '" & Me.Sub!Items & "', Details.Qy = " & Me.Sub!Qy, Price =" & Me.Sub!Price, Details.Total = " & Me.Sub!Total & "

  6. #21
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,896
    Doh! Head Slap! Glad Gina was on the ball!

    Read through this thread again. Still confused why you are doing this. If Details is not a subform of SaleInvoice, what is? Why isn't it? Why are you duplicating data?

    If you want to provide db for analysis, follow instructions at bottom of my post.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  7. #22
    Mehvan's Avatar
    Mehvan is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Sep 2016
    Posts
    133
    it's updating data if I don't use Line of FROM , but it change all data to the same first line data
    because we removed WHERE condition

    this is real data in Form
    :

    Click image for larger version. 

Name:	1.PNG 
Views:	11 
Size:	24.5 KB 
ID:	35748

    this is result after update in Details Table
    :

    Click image for larger version. 

Name:	2.PNG 
Views:	11 
Size:	7.2 KB 
ID:	35749

    if We use FROM line , its gave us the same problem , but if we don't use it , it's updating data but with the same first data record

  8. #23
    GinaWhipp's Avatar
    GinaWhipp is offline Competent Performer
    Windows 7 64bit Access 2013 32bit
    Join Date
    Jul 2011
    Location
    Ohio, USA
    Posts
    377
    It's updating the data because it's what you told it to do. Why don't you help us out and tell us *exactly* what you want to happen. As a side note, you cannot UPDATE and INSERT using the same query.

  9. #24
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,896
    Use WHERE clause if you want to limit UPDATE to a specific record.

    Saving calculated data (data dependent on other data) is usually unnecessary and ill-advised. The calculated data can become 'out of sync' with raw data. The Total should be calculated when needed.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

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

Similar Threads

  1. Replies: 6
    Last Post: 02-11-2018, 02:06 PM
  2. Replies: 1
    Last Post: 11-04-2015, 07:25 AM
  3. Replies: 8
    Last Post: 05-30-2013, 05:06 PM
  4. Update Main Form From Subform
    By burrina in forum Forms
    Replies: 7
    Last Post: 02-06-2013, 03:55 PM
  5. Requery subform after update of main form
    By gemadan96 in forum Forms
    Replies: 3
    Last Post: 10-17-2012, 02:33 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