Consulting

Results 1 to 3 of 3

Thread: [Access] Help for assigning checkbox to a recordset value?

  1. #1

    [Access] Help for assigning checkbox to a recordset value?

    Private Sub Command13_Click()
    Dim abc as string
     
    abc = Combo10.Value
    
    
    
    forms!abc.Check1 = rst![name]    ‘assign check1 to one recordset  checkbox
    DoCmd.OpenForm abc, acNormal
     
    End Sub

    This command 13 button will open a form according to the combo10.value which the user chooses. I have many different forms’ names assigned to combo10.

    There is an error when I run the above code because the forms!abc.check1 has an error.
    This is because access cannot read the different forms names under abc.

    Is there another way for forms!abc.Check1 to work when the forms names under abc will change?

    Thanks.
    Last edited by spidermman; 11-04-2008 at 10:22 AM.

  2. #2
    VBAX Master CreganTur's Avatar
    Joined
    Jan 2008
    Location
    Greensboro, NC
    Posts
    1,676
    Location
    You cannot assign a value to a checkbox object other than True (checked) or False (unchecked). Attempting to assign any other value to the checkbox is invalid and will result in an error.

    From your code it looks like you are using the object's default names (Check1, Command13, etc). This is not best practice and is a bad idea! You should really give all of your objects unique names that describe the object's purpose. This will make it much easier to code if you come back to the project after a long time, since you won't have to manually scan through multiple objects looking for Label141.
    -Randy Shea
    I'm a programmer, but I'm also pro-grammar!
    If your issue is resolved, please use Thread Tools to mark your thread as Solved!

    PODA (Professional Office Developers Association) | Certifiable | MOS: Access 2003


  3. #3
    sorry i am not clear in the firstpost...
    i am assigning a checkbox to the checkbox in the recordset.

    for each form, there is a checklist whereby the user will tick the checkbox against the procedure that has been completed. Afterwhich, the user will save the form.

    When i reopen the form, i would assign the check1 in the saved form to the recordset value.

    However the forms!abc.check1 does not work because the form names under abc are different when the user choose a different form to open.

    Is there a way to reopen saved forms?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •