G
Guest
In the Load event of a form that adds notes to a given project, I want to
check if a record already exists for the given Project
Number/StaffID/NoteDate combination. The values of these three fields are
stored in textboxes on the form from which the Notes form is opened. Since
this can be two different forms, the name of the form is passed using
OpenArgs.
The types of the above fields are Text, Integer, and Date/Time,
respectively. The DCount call below crashes with a Type Mismatch error. I'd
appreciate any help.
If DCount("[ProjectNoteID]", "ProjectNotes", _
"[ProjectNumber]=" & "'" &
Forms(Me.OpenArgs).Controls("txtProjectNumber") & "'" & _
" AND [StaffID] = " & Val(Forms(Me.OpenArgs).Controls("txtStaffID"))
& _
" AND [NoteDate] = " & "#" &
Forms(Me.OpenArgs).Controls("txtPeriodStartDate") & "#" + _
Val(Forms(Me.OpenArgs).Controls("txtDayNumber"))) = 0 Then
.... do stuff
Thank you.
Sprinks
check if a record already exists for the given Project
Number/StaffID/NoteDate combination. The values of these three fields are
stored in textboxes on the form from which the Notes form is opened. Since
this can be two different forms, the name of the form is passed using
OpenArgs.
The types of the above fields are Text, Integer, and Date/Time,
respectively. The DCount call below crashes with a Type Mismatch error. I'd
appreciate any help.
If DCount("[ProjectNoteID]", "ProjectNotes", _
"[ProjectNumber]=" & "'" &
Forms(Me.OpenArgs).Controls("txtProjectNumber") & "'" & _
" AND [StaffID] = " & Val(Forms(Me.OpenArgs).Controls("txtStaffID"))
& _
" AND [NoteDate] = " & "#" &
Forms(Me.OpenArgs).Controls("txtPeriodStartDate") & "#" + _
Val(Forms(Me.OpenArgs).Controls("txtDayNumber"))) = 0 Then
.... do stuff
Thank you.
Sprinks