Albert Kallal or Marshall Barton Help please

D

Design by Sue

Multi Select Example:
http://www.members.shaw.ca/AlbertKallal/msaccess/msaccess.html

From another post Marshall, you suggested the code above to solve my problem
of an undbound check box in a continous form. This really looks like it will
work for me. I have spent about 2 hours going over the code and trying to
change it for my database, but I am missing something. Would either of you
be willing to help? Please.

Sue
 
D

Design by Sue

Not sure if this will help but here is the entire code for the form I am
trying to use the code on. I am so sure I have missed something simple to
those who know this stuff but I'm at my wits end. With it like this, all
check boxes are selected when one is chosen and when I try to uncheck the box
I get a debug error "Invalid procedure call or arguement."

In advance, thanks for your help.

Sue

Option Compare Database

Dim colCheckBox As New Collection


Public Function IsChecked(vID As Variant) As Boolean

Dim lngID As Variant

IsChecked = False

If IsNull(vID) = True Then Exit Function

For Each lngID In colCheckBox
If vID = lngID Then
IsChecked = True
Exit For
End If
Next lngID


End Function

Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)

' key hand

Select Case KeyCode

Case vbKeyUp
KeyCode = 0
On Error Resume Next
DoCmd.GoToRecord acActiveDataObject, , acPrevious

Case vbKeyDown
KeyCode = 0
On Error Resume Next
DoCmd.GoToRecord acActiveDataObject, , acNext

' Case vbKeyReturn
' If IsNull(Me.ID) = False Then
' KeyCode = 0
' Call EditMain
' End If

End Select
End Sub





Private Sub Return_Click()

If IsChecked(Me.PartNumber) = False Then
colCheckBox.Add CStr(Me.PartNumber)
Else
colCheckBox.Remove (CStr(Me.PartNumber))
End If
Me.Return.Requery



End Sub
Private Function MySelected() As String


Dim i As Integer

For i = 1 To colCheckBox.Count
If MySelected <> "" Then
MySelected = MySelected & ","
End If
MySelected = MySelected & colCheckBox(i)

Next i


End Function
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top