do not add if already in list & reset check box

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a form that allows you to go through customer records one at a time.
The only purpose is to fill in the "comment" field from a combo box- then
move on to the next record.

If the proper comment is not in the list- they are allowed to type in their
own comments- then check the check box to add to the list.

Therein lies the problem:

1.) I want the check box to reset itself so it isn't checked when you move
to the next record
3.) I do not want to add a comment that is already in the list

This is what I have so far....
On Error GoTo Err_Command32_Click
DoCmd.SetWarnings False
If Me.Check34 = True Then
DoCmd.FindRecord Me.Notes, , True, , True
If--------------------------------'insert whatever code means not found'
DoCmd.RunSQL "INSERT INTO Comments (Comments) VALUES
(Comment_import_details.Notes)"
End If
End If
DoCmd.GoToRecord , , acNext
Exit_Command32_Click:
Exit Sub
Err_Command32_Click:
MsgBox Err.Description
Resume Exit_Command32_Click
 
There may be a better method than this however if you insert the Dlookup
command right there and enclose it in a Nz( Dlookup , 0 ) process then test
to see if it is zero add it and if <> 0 then it found nothing....

Dwight
 
Back
Top