• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 435
  • Last Modified:

How to use an unbound checkbox for multi selection in a continuous form

Actually I have one main form when one of the button of this form is clicked it open modal  continous form where i have one unbound checkbox.When this checkbox is checked i need to assign value of one of the textbox of main form to textbox of the subform.
I am able to grab the value of main form textbox value to one of the variable defined in the subform.But i am unable to do the task of assign the value of that variable to textbox of subform when unbound checkbox is checked.Here is some code which i try by creating the transparent command button named Command39   :

Public Profile_ID As Integer(Note:this is the variable which contain value of textbox  of main form)
Dim colCheckbox As New Collection

Public Function IsChecked(vID As Variant) As Boolean
   Dim lngID      As Long
   IsChecked = False
   On Error GoTo exit1
   lngID = colCheckbox(CStr(vID))
   If lngID <> 0 Then
      IsChecked = True
   End If
exit1:
End Function

Private Sub Command39_Click()
On Error GoTo Err_Command39_Click

 If IsChecked(Me.ProfileID) = False Then
      colCheckbox.Add CLng(Me.ProfileID), CStr(Me.ProfileID)
   Else
      colCheckbox.Remove (CStr(Me.ProfileID))
   End If
   Me.chkbox_AssociatedImage.Requery

Exit_Command39_Click:
    Exit Sub

Err_Command39_Click:
    MsgBox Err.DESCRIPTION
    Resume Exit_Command39_Click
   
End Sub

In above code name of checkbox is chkbox_AssociatedImage and  ProfileID is name of textbox of the subform where value need to be assign when chekbox is checked.And on last thing i used control source of checkbox like this: =IsChecked([ProfileID])

SO can anybody help me by suggesting what is wrong with my aprroach.I will really happy if somebody provide me solution of my problem.

Thank you
0
smyleekumar
Asked:
smyleekumar
1 Solution
 
hnasrCommented:
Attach a sample database with the issue, and instructions to follow.
0
 
Richard DanekeTrainerCommented:
You will need to use a bound checkbox.  An unbound checkbox value is set for all of the continuous forms.   If you don't want to add the field to the existing table, this can be done by using a transaaction table with a key to the related table and the yes/no field.
0
 
smyleekumarAuthor Commented:
Hi DoDahD
Can you elaborate more so it make me more clear because i m new to vba
Thank You
0
 
Richard DanekeTrainerCommented:
I forgot to ask what version you are using.
Sometimes a template can demostrate some very interesting techniques.  The attached AC2007 marketing projects templates shows a technique for using a query to hyperlink to a related record - avoiding the VBA challenges and is easy for internet savy operators to understand.  
It also shows interfacing to Outlook, email data collection, the new form options to add when not in a combo box list.    
Let me know if you are on an earlier version.
Marketing-projects.accdb
0
 
Patrick MatthewsCommented:
This question has been classified as abandoned and is being closed as part of the Cleanup Program.  See my comment at the end of the question for more details.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now