The search and updates are attended to in a function, as
there are many AfterUpdate events associated with the
task. Here's the function, where you see that any possible
text box control bug should not be an issue:
Private Function MarkDuplicates(strTop As String) As Boolean
'============================================='
' "strTop" is our current choice as a new topic. So, we look in the    '
' history RS to see if it's already been used. If so, we set the
'
' "duplicated" flag in the history file so the topic will show high-
'
' lighted in subsequent topic history displays.
'
'============================================='
Dim Mark As Boolean
With Forms!TopicsHistory.RecordsetClone   'Identify the history RS
.FindFirst "Topic = """ & strTop & """"           'Look for current choice
Mark = Not .nomatch                                    'Want "True" if
found
If Mark = True Then                                   'Was it found?
.Edit                                                      'Yes,
update history RS
.Dup = Ture                                          '
.Update                                                 '
End If
End With
MarkDuplicates = Mark                                'Return "find
results"
End Function
Thanks for your help,
Bill
	
		
			
				Marshall Barton said:
			
		
	
	
		
		
			Right!
Glad you were able to sort it out while I was unavailable.
Based on an old check box control bug (I think it was fixed
yeas ago), I write the If statement this way:
If Me.Dup1 = True Then
.Edit
.Dup = True
.Update
End If
--
Marsh
MVP [MS Access]
Bill wrote:
Forgot the .Update after the .Dup = Me.Dup1
All is well now.
Thanks,
Bill
I've tried:
With Forms!TopicsHistory.RecordsetClone
.FindFirst "Topic = """ & Me.tbTopic1 & """"
Me.Dup1 = Not .nomatch
If Me.Dup1 then
.Edit
.Dup = Me.Dup1
End If
End With
Access doesn't complain, but the record found via
the "FindFirst" did not get its "Dup" field updated.
Bill wrote:
I have a form named TopicsHistory whose recordsource
is a simple query. TopicsHistory opens another form, "B",
that amongst its tasks is a search in TopicsHistory's
recordsource looking for a duplicate. The code below
encounters a runtime error 2465 in not being able to find
the "field" TopicsHistory, which is not a field but is the
name of the form whose recordset is the object of the
search. Is what I've coded inappropriate for what I'm
trying to accomplish?
Me![TopicsHistory].Form.Recordset.FindFirst "Topic = """ &
Me.tbTopic1
&
""""
If Me![TopicsHistory].Form.Recordset.NoMatch = False Then Me.Dup1 =
"Yes"
Your code should work if TopicsHistory is a subform
(control) on form B.  Also, unless you are also navigating
to the found record, you should use the RecordsetClone
property instead of Recordset.
If TopicsHistory really is a separate form, your code would
be:
With Forms!TopicsHistory.RecordsetClone
.FindFirst "Topic = """ & Me.tbTopic1 & """"
If .NoMatch Then Me.Dup1 = "Yes"
End With