Results 1 to 9 of 9
  1. #1
    chuckdarwin is offline Novice
    Windows 7 64bit Access 2016
    Join Date
    Jan 2018
    Posts
    15

    Update Query

    I created this query looks like it should work to me but it does not

    Before i added the Criteria it worked like a charm but as soon as I added the Where Statement it doesnt update anything. Can someone tell me what i dod wrong ??


    UPDATE Broods SET Broods.[Produce Fed to Date] = [Forms]![Feed Logging]![Producetxt]+[Broods]![Produce Fed to Date], Broods.[Protein Fed to Date] = [Forms]![Feed Logging]![Proteintxt]+[Broods]![Protein Fed to Date], Broods.[Last Fed] = Date()


    WHERE ((([Forms]![Feed Logging]![Combo0])=[Broods]![Bin ID]));

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,525
    so if you paste this sql into a query and run it , does it give an error?
    if no error, does the query tell you it will modify N records?

  3. #3
    chuckdarwin is offline Novice
    Windows 7 64bit Access 2016
    Join Date
    Jan 2018
    Posts
    15
    No error at all It pops up the "you are about to update window" and then says it updated zero records when it should be updating one record the Bin ID selected in the combo box.

  4. #4
    chuckdarwin is offline Novice
    Windows 7 64bit Access 2016
    Join Date
    Jan 2018
    Posts
    15
    When i remove the Where statement it updates all the records displayed in the combobox dropdown which is what i would expect.

  5. #5
    chuckdarwin is offline Novice
    Windows 7 64bit Access 2016
    Join Date
    Jan 2018
    Posts
    15
    changed it up a little no difference.

    UPDATE Broods SET Broods.[Produce Fed to Date] = [Forms]![Feed Logging]![Producetxt]+[Broods]![Produce Fed to Date], Broods.[Protein Fed to Date] = [Forms]![Feed Logging]![Proteintxt]+[Broods]![Protein Fed to Date], Broods.[Last Fed] = Date()
    WHERE (((Broods.[Bin ID])=[Forms]![Feed Logging]![Combo0]) AND ((Broods.Retired)=False));

  6. #6
    chuckdarwin is offline Novice
    Windows 7 64bit Access 2016
    Join Date
    Jan 2018
    Posts
    15
    I changed it to a select command and renamed the combo box tag to see what it was resolving
    it resolves zero data so i checked my data
    retired flag is false on all records
    I set it to show me what the combo box was resolving as and it was null

    Not sure why shouldn't ![Feed Logging]![Combo0] give me the value selected in the combo box ?

  7. #7
    John_G is offline VIP
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2011
    Location
    Ottawa, ON (area)
    Posts
    2,615
    Not sure why shouldn't ![Feed Logging]![Combo0] give me the value selected in the combo box ?
    Possibly because your combo box isn't set up properly. How many columns are in the combo box, how many are visible, and which column of the combo is the Bound Column?
    ![Feed Logging]![Combo0] will give you the bound column value by default.

    Typically, a combo box has a hidden (usually numeric) column that is also the bound column, while the combo box displays related text (name, description, department, etc.)

  8. #8
    ssanfu is offline Master of Nothing
    Windows 7 32bit Access 2010 32bit
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    Any chance you would post your dB (just a few records for testing) so we can see what you actually have?
    Make a copy of your dB, delete records leaving a few, do a "Compact & Repair" and zip it.

  9. #9
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    I offer same suggestion as in your other thread https://www.accessforums.net/showthread.php?t=70232
    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.

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

Similar Threads

  1. Replies: 2
    Last Post: 08-03-2017, 04:58 AM
  2. Replies: 1
    Last Post: 10-27-2016, 12:14 PM
  3. Query Update/Select Query (Wont Update)
    By NickWren in forum Access
    Replies: 1
    Last Post: 03-30-2016, 10:41 AM
  4. Replies: 7
    Last Post: 08-26-2013, 06:05 AM
  5. Replies: 2
    Last Post: 08-30-2012, 07:59 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