Aggregate query and Albert Kallal's Multiselect example

  • Thread starter Corey-g via AccessMonster.com
  • Start date
C

Corey-g via AccessMonster.com

Hi All,

I am attempting to build a continuous form that will allow users to
'purchase' items. The recordsource is an aggregate query that groups by part
number and a boolean 'Rush' field, and sums the quantity ordered. The query
works the way I want it too...

Now I am trying to have a checkbox on this form for users to select, and that
would mark the item(s) for ordering. I added in the 'ID' field that is the
PK for the 'parts' - and used this while following Albert's Multi-Select
example. The problem is that there can be 2 of the same items to be ordered,
but with different 'Rush' flag values. And if I select one of these, then
all of them get 'selected' - which isn't what I want. I tried to change it
around to use the 'CurrentRecord' value, but now nothing works...

Here is some background:

Form has 4 fields and the checkbox: Part Number, Channel, Vendor, Sum_Of_QTY -
-> and check6.
Query: qryProcure_Items - aggregate query summing Qty, and grouping on the
others (of course).

So: If there is Part "1" 3 times, and one is a rush, there would be 2
records one for the rush, and one for the other 2 items.

I have the 2 functions from Albert - IsChecked() and Command5_Click() -->
this is the transparent button over top the checkbox as per Albert's example.

The code in these functions is:

Private Sub Command5_Click()
If IsChecked(Me.CurrentRecord) = False Then
colOrdered.Add CStr(Me.PART_NUMBER), CStr(Me.CurrentRecord)
' I have also tried to use the part_id instead of part_number - but that
caused the issue mentioned above
Else
colOrdered.Remove (CStr(Me.CurrentRecord))
End If
Me.Check6.Requery
Debug.Print Me.CurrentRecord & " was Clicked"
End Sub


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 colOrdered
If vID = lngID Then
IsChecked = True
Exit For
End If
Next lngID
MsgBox vID
End Function


Anyone have any ideas or work-arounds?

Thanks,

Corey
 
C

Corey-g via AccessMonster.com

Hi everyone,

I just wanted to let people know that htis can be done - but I had to 'build'
a unique string out of my data. I would think it runs a little slower
because I had to use text comparisons rather than numeric, but it works just
the same...

Corey
 

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