Results 1 to 3 of 3
  1. #1
    alex423 is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Aug 2013
    Posts
    2

    Checkboxes in a form, how to save the data

    I'm kind of new using access 2010, I'm creating a DB to store the information about computers (Assets) for a company, to try to make my life a little easier I'm using one of the templates from Microsoft Office and I'm doing some modifications to it.



    I have a form named Assets Details, where I enter the details for each computer (i.e: Type of computer, Manufacturer, Model, etc) the last Tab in that form is the Software installed on each machine. In this example I added 3 Checkmarks just for purpose of testing (Antivirus, Windows Updates, Microsoft Office) but actually it will be more than 20 different software that can be installed in one machine.

    I'm using the checkboxes just to have an easy interface for the customer, so if the customer installed the antivirus he just need to click the check mark and that's it. I'm trying to follow this explanation on this website http://allenbrowne.com/casu-23.html but instead of having a subform with a combo I would like to have the check boxes.

    I have 3 tables Assets (Where I save the details for each computer), table Software (where I store the list of software, i.e. 1 Antivirus, 2 Windows Updates, 3 Microsoft Office, etc) and my 3rd table is Software Installed where I store what software is installed to each computer.

    My question is how can I save the data in my 3rd table (Software Installed) using the Checkmarks, since a checkmark is a yes/no control. Any help with this is really appreciated, I've trying to figure it out how to work with a checkmark but I'm giving up

    I'm attaching the database so any of you can look at my form "Asset Details" and my relationships.
    Attached Files Attached Files

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    Use code to write records to Software Installed table for each checkbox selected. Something like:

    If Me.Chkbox1 Then CurrentDb.Execute "INSERT INTO [Software Installed](AssetID, SoftwareID) VALUES(" & Me.ID & ", 1)"

    The real trick is figuring out what event to put code in - maybe the form AfterUpdate event. Also, there is the issue of preventing duplicate entries. One way is to set ID (rename to AssetID) and SoftwareID in Software Installed as a compound primary key.


    BTW, advise no spaces or special characters/punctuation (underscore is exception) in names
    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.

  3. #3
    alex423 is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Aug 2013
    Posts
    2
    Thank you

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

Similar Threads

  1. Combo Box wont save data to Form
    By pimpzter in forum Access
    Replies: 1
    Last Post: 07-13-2012, 01:25 PM
  2. Replies: 5
    Last Post: 06-15-2012, 02:03 PM
  3. Replies: 4
    Last Post: 12-22-2011, 03:04 AM
  4. Using VB to save data in a form
    By blueraincoat in forum Forms
    Replies: 7
    Last Post: 03-25-2011, 09:06 AM
  5. Replies: 4
    Last Post: 01-05-2011, 07:56 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