Re: checkboxes on a form and values in a table

From: Allen Browne (AllenBrowne_at_SeeSig.Invalid)
Date: 10/07/04


Date: Fri, 8 Oct 2004 00:26:43 +0800

Hmm. A bit field, interfaced with 5 unbound check boxes.

In Access it's probably better to use the AfterUpdate event of the text
boxes to calculate the bit value, and write to your integer field.

All references in a bound form are automatically the current record. The
field you are writing to does not have to be represented by a text box: so
long as it appears in the form's RecordSource.

When you move record, the Current event of the form fires, so that's the one
you need to use to parse the bit-field and set your text boxes. You should
also use the Undo event of the form, to reset the textboxes, based on the
OldValue of the bit-field.

-- 
Allen Browne - Microsoft MVP.  Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.
"SabreWolf3" <SabreWolf3@discussions.microsoft.com> wrote in message
news:D42A5006-A004-4B29-BDCE-05413F20C870@microsoft.com...
> Hi all,
>
> I am very new to access, but I do have some VBA experience.
>
> I have created a form with 5 checkboxes that represent contact methods for
> customers (Mail, phone, email, pager, other).  Any combination from all 
> blank
> to all checked is possible, which is 32 distinct possibilities.  Here are 
> the
> two things I want to do, but I just do not know how to accomplish them in
> Access.
>
> As the user checks the checkboxes, I will use the OnClick method to 
> evaluate
> the state of all 5 checkboxes.  Based on which checkboxes are selected, I
> want to write a binary value from 0 to 31 into the "contact method"  field 
> of
> the current record.  In VBA, I do not know how to reference the current
> record, nor the current field to write the value.  Can someone help with
> this?  The form name is frm:Master_Form, the table name is 
> tbl:Master_Table
> and the field name is Contact Method.
>
> Secondly, the form contains the record navigation controls at the bottom.
> When a user clicks on any of those controls to change records, what event 
> can
> I use to evaluate the Contact Method field for the currently selected 
> record,
> so that I can check the appropriate checkboxes?  What would that code look
> like?
>
> Many thanks,
> Richard 


Relevant Pages

  • Re: Different data shown based on user input
    ... my advice changes with the info that there are over 200 checkboxes. ... I suggest you use combo boxes. ... Dim strStub As String ...
    (microsoft.public.access.queries)
  • Re: Different data shown based on user input
    ... A form that knows which check boxes have been checked can be created like ... --check only one check box and observe that the other checkboxes are ... The basic process is to build the query using the fields that have been ... Dim strStub as String ...
    (microsoft.public.access.queries)
  • Re: Checkbox cannot be used on 2003 document
    ... If the check boxes are from the legacy controls (which they will be if the ... can insert and remove checks from the checkboxes in that document. ... I could not find teh checkbox tool in teh 2007 native ...
    (microsoft.public.word.docmanagement)
  • Re: Multiple Checkboxes in Search by Form
    ... from checkboxes to a multi-select list box can I also make that change in my ... > build up the WhereCondition string to open a report, ... If none of the boxes are checked, ... > Dim strWhere As String ...
    (microsoft.public.access.queries)
  • Re: Allowing only 1 check box to be ticked
    ... check boxes, but I really don't think I get a choice in the matter. ... for each cbx in activecell.entirerow.checkboxes ... But you can cycle through all the checkboxes and look at the position of each ... I tried to edit your macro but didn't have any luck. ...
    (microsoft.public.excel.misc)