Search code examples
ms-accessvbams-access-2007

Microsoft Access - use checkbox to save text from textbox


I´m making a register form in microsoft access and there is a text box to put the email.

At the end of the sign up form, there is a check box to check either the user wants to receive newsletter or not.

Just part of the form: image

I want to be not checked by default and checked if the user wants.

How can i save the email from the textbox in a table?


Solution

  • You do not have to do anything, as this form is bound to the table you are entering the information into. The Email address being the primary key will be entered as default. The checkbox is bound to the table too. So when the default value would be False, so you do not have to worry about it at all.

    To display all of the information for the users who have opted for the mailing list. You first create a Query. The Query for mailing list would be something as simple as

    SELECT 
        *
    FROM 
        yourTableName 
    WHERE 
        yourCheckBoxField = True; 
    

    If you want to create a NewTable from this SELECT Query, use the following

    SELECT 
        * 
    INTO
        yourNewTableName
    FROM 
        yourTableName 
    WHERE 
        yourCheckBoxField = True; 
    

    Then give this a name say qry_MailingListUsers, then base this Query to create a Form, using the Form Design. Simple !

    I hope this helps !