WestWingFan said:
Dirk,
Ok. Here goes. Purpose: We are trying to collect feedback from the users
about the ways these two things (AASSID and TARSkillClusterID) interact.
The
intented use is to record a rating (1-3 so I'm using an option group bound
to
ConvActivityRating) and comments (bound to ConvActivitycomments) from the
users about the various intersections of AASSID and TARSkillClusterID.
The table has fields(of type): RtgID(autonumber),
TARSkillClusterID(number),
AASSID(number), ConvActivityRating(number), and ConvActivityComments(text-
maybe should be memo).
The form has controls in the header, details, and footer.
In the header, there are three unbound controls. The first is a combo box
to
correctly filter the second. The second is a listbox to correctly filter
the
third. The third is a listbox (lstGroupingSelect), which allows the user
to
select the desired TARSkillClusterID.
In the details section, the first control is a listbox (unbound) which
displays (no add or edits here) the results of a query based on the
TARSkillClusterID. The users need to see this information to produce their
rating. The second control is the listbox (unbound) also known as
lstAASSselect. I'll post the code in the after event procedure below. The
third control(s?) is an option group(bound to ConvActivityRating). The
fourth
control is the text field for user comments (bound to
ConvActivityComments).
In the footer is a subform which allows the user to make suggestions. I'll
give you more detail on this if you think it is relevant.
On to the code....
Private Sub LstAASSselect_AfterUpdate()
Dim rs As Object
Set rs = Me.Recordset.Clone
rs.FindFirst "[TARSkillClusterID] = " & Me!lstGroupingSelect & " AND _
[AASSID] = " & Me!LstAASSselect
If Not rs.EOF Then Me.Bookmark = rs.Bookmark
End Sub
That code is wrong. In particular, the FindFirst call is *not* what I
posted, and not equivalent to it. But also, the checking for the "record
not found" condition is not correct for an .mdb or .accdb file. (Yes, I
know that matches what the "Find Record" combo box wizard produces, but it's
still wrong.) Try this:
'----- start of revised code -----
Private Sub LstAASSselect_AfterUpdate()
With Me.RecordsetClone
.FindFirst "[TARSkillClusterID] = " & Me!lstGroupingSelect & _
" AND [AASSID] = " & Me!LstAASSselect
If .NoMatch Then
MsgBox _
"No record was found matching your selection.", _
vbInformation, _
"Record Not Found"
Else
Me.Bookmark = .Bookmark
End If
End With
End Sub
'----- end of revised code -----
Please let me know if I need to clarify anything. Thanks again!
Let me ask a couple of questions to verify and clarify my understanding.
Are you saying that the table is prepopulated with one and only one record
for every combination of TARSkillClusterID and AASSID? So the purpose of
this form is to allow the user to update those existing records?
What is the user's intended interaction with the form? Does the following
describe it?
1. Open Form
2. Choose from combo in header
3. Choose from first list box in header
4. Choose from lstGroupingSelect (in header)
5. Choose from lstAASSselect (in detail)
(form positions to record matching lstGroupingSelect and lstAASSselect)
6. Edit ConvActivityRating and ConvActivityComments
7. Enter suggestion in subform if desired
8. Repeat from step 5 until done with current TARSkillClusterID
9. Repeat from step 4 until done with current supergroup (defined by step 3)
10. Repeat from step 3 until done with current super-supergroup (defined by
step 2)
11. Repeat from step 2 until done with all records.
12. Close form.
Is there any other code behind this form? If my understanding is correct,
then I would expect the code revision above to get the job done.
--
Dirk Goldgar, MS Access MVP
www.datagnostics.com
(please reply to the newsgroup)