Unbound check and text box's on a continuous forms

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • phill86
    New Member
    • Mar 2008
    • 121

    Unbound check and text box's on a continuous forms

    Hi,

    I have a continuous form with check boxes and text boxes that I need to be unbound.

    I want to apply formatting to the text boxes and check boxes on the individual records in the continuous form i understand that this is not possible unless the controls are bound to a field in a table.

    I have found an example database written by Albert Kallal at the following link that allows you to use a unbound check box on individual records on a continuous form.


    (Multi Select Example)

    http://www.members.sha w.ca/AlbertKallal/msaccess/msaccess.html


    Which is great and I have got this working in my form.

    the form is designed to be an equipment booking form so the idea is I have a list of equipment which the user is able to book to a date and time.

    I am trying to display when a piece of equipment is booked by changing the colour of the text boxes which represent time slots throughout 09:00 - 00:00 so green if the equipment is available and red if not.

    I am hoping that the above example can be manipulated to enable me to change the colour of the text boxes I must admit that I do not fully understand how the checkbox example works and have tried several times to apply the colour changes to a text box without success

    The code that makes it work is as follows

    Code:
    Option Compare Database
    Option Explicit
    
    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 Command13_Click()
    Debug.Print "contact = " & Me.ContactID
    
       If IsChecked(Me.ContactID) = False Then
          colCheckBox.Add CLng(Me.ContactID), CStr(Me.ContactID)
       Else
          colCheckBox.Remove (CStr(Me.ContactID))
       End If
       Me.Check11.Requery
       
    End Sub
    I hope I am making at least some sense if you download the database and take a look it will become clearer


    Any help is much appreciated

    Regards Phill
Working...