Results 1 to 3 of 3
  1. #1
    sdel_nevo is offline Competent Performer
    Windows 10 Access 2010 32bit
    Join Date
    Apr 2013
    Location
    Gloucester, UK
    Posts
    402

    Update query, update text feild based on checkbox

    Hi Guys

    I cant seem to get my head around this problem

    this is the query that I need to amend, currently it works really well and updates the "reelweight" with the value entered on the form "frmTestSheetEnterTestResults"

    Code:
    UPDATE tblTestsResults SET tblTestsResults.ReelWeight = [Forms]![frmTestSheetEnterTestResults]![ReelWeightHeaderTXTBox], tblTestsResults.MachineName = [Forms]![frmTestSheetEnterTestResults]![MachineNameHeaderTXTBox], tblTestsResults.TestType = "ENTER IIF HERE"
    WHERE (((tblTestsResults.ReelWeight) Is Null) AND ((tblTestsResults.ProductionOrderID)=[forms]![frmTestSheetEnterTestResults]![ProductionOrderID]) AND ((tblTestsResults.TestSheetID)=[Forms]![frmTestSheetEnterTestResults]![TestSheetID]) AND ((tblTestsResults.ReelNumber)=[forms]![frmTestSheetEnterTestResults]![ReelNumber]));
    what I need to do now is update the tblTestsResults.TestType with either "Scrap" or "Prime" depending on a checkbox "Checkbox99" being clicked on the form "frmTestSheetEnterTestResults"

    if the checkbox is clicked, I need to update the "Testtype" field to "Scrap" and if it's not the update "testtype" field to "Prime"

    I hope this makes sense I just cant seem to get my head around this

    any help would be great



    many thanks

    steve

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,511
    make an invisible textbox on the form, fill it with the result of the checkbox afterupdate event

    Code:
    sub checkBox99_afterupdate()
    if checkbox99.value then
       txtBox =  "Scrap"
    else
       txtBox =  "Prime"
    endif
    end sub
    then your query can just use the box to update the field.
    be sure to set the text box 'default' value .

  3. #3
    sdel_nevo is offline Competent Performer
    Windows 10 Access 2010 32bit
    Join Date
    Apr 2013
    Location
    Gloucester, UK
    Posts
    402
    Hi Ranman256

    OMG lol never even thought about that
    such a simple way

    many many thanks

    Steve

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

Similar Threads

  1. Replies: 3
    Last Post: 06-24-2017, 07:37 AM
  2. Replies: 2
    Last Post: 10-28-2014, 03:55 AM
  3. Replies: 3
    Last Post: 12-09-2011, 11:55 AM
  4. Replies: 10
    Last Post: 07-02-2011, 11:51 AM
  5. Update a text box based on a combo box
    By fleschnj in forum Access
    Replies: 1
    Last Post: 11-08-2010, 12:14 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