Results 1 to 11 of 11
  1. #1
    sud2017 is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Jul 2017
    Posts
    148

    Checkbox to store into Table Field

    I have a checkbox (ChkWest) and a bound Textbox field 'TxtAssyQty' (controlsource is from a Table). When user checks the checkbox 'chkWest', I want to store the TxtAssyQty =1, to be stored in that table.

    I understood how to update ChkWest value to an unbound Textbox but I am not sure how to store into the table.

    Would greatly appreciate for any possible help.



    Thanks very much.

  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
    I'm not sure I understand. Updating a bound textbox would be the same as updating an unbound textbox.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    sud2017 is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Jul 2017
    Posts
    148
    Sorry for not being very clear. To update the Unbound textbox value based on checkbox selection, I previously have used IIF statement in the Controlsource of that textbox (IIF(ChkWest = True, "1", "0"). However, by doing this, the textbox doesn't store the value to the table as the textbox becomes unbound. I hope I haven't confused you more. Is there a different way to store value to the table field based on checkbox selection? Thanks for any possible help.

  4. #4
    Bulzie is online now VIP
    Windows 7 64bit Access 2007
    Join Date
    Nov 2015
    Posts
    1,470
    I think Paul saying why not just bind the check box on the form to the field in the table?

  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,521
    In the after update event of the checkbox try:

    Me.TextboxName = IIF(ChkWest = True, 1, 0)
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  6. #6
    sud2017 is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Jul 2017
    Posts
    148
    Thank you very much Paul and Bulzie. Great suggestions. I have bound check box on the form directly to the field in the table but when its checked it stores value "-1", when unchecked it works fine with "0". Please advise. Thank you again.

  7. #7
    Bulzie is online now VIP
    Windows 7 64bit Access 2007
    Join Date
    Nov 2015
    Posts
    1,470
    Thats just how it stores it in the table, -1 = True, 0 = False.

  8. #8
    sud2017 is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Jul 2017
    Posts
    148
    Thanks again for your quick reply Bulzie. I want the stored value to be "1" instead of -1 when the checkbox = true, as I intend to use this stored value for a calculation in my form. Would appreciate your further advise to achieve this or if there is anything wrong with my approach. Your time is much appreciated.

  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,521
    Did you miss post 5?
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  10. #10
    sud2017 is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Jul 2017
    Posts
    148
    Did you miss post 5?
    Paul - this worked so great. sorry I had missed that post. You are awesome. I was struggling with this for last 2 days.

    Thank you and have a great day to both of you.

  11. #11
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    No problem. Sometimes answers get lost in the clutter.
    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. Store an IIF option is a table field
    By archie1_za in forum Database Design
    Replies: 10
    Last Post: 11-01-2017, 06:54 AM
  2. Replies: 5
    Last Post: 03-30-2017, 03:58 PM
  3. Replies: 1
    Last Post: 11-26-2014, 02:30 PM
  4. Replies: 7
    Last Post: 11-03-2012, 06:17 PM
  5. Replies: 0
    Last Post: 09-25-2006, 03:42 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