Validation Rule error

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

Guest

In my DB I have users enter data through a form that puts the data into a
temp table before appending the data to a main table called Details. The
Details table serves as a history of all edits to a particular record. Each
record includes a field called [Activity Name]. I want to ensure that when a
new entry is created, not an edit to an existing entry, that the Activity
Name the user enters is new. I've tried using DLOOKUP in the form field
validation rule. Here is the rule code:

=DLookUp([Activity Name],"Details","[Activity Name] =
Forms!Details![Activity Name]") Is Null

I based this on the example in the Access Help. However, when the field
attempts to validated against this code, I get the following error:

There is a(n) " in the form control's ValidationRule Property.

Can anyone suggest what I've done wrong? Thanks in advance for any
assistance sent my way.

gt
 
Try this
If isnull(DLookUp("[Activity Name]","Details","[Activity Name] = '" &
Forms!Details![Activity Name] & "'")) Then
 
Ofer, thanks. Where I went wrong was not getting the apostrophes. The
original code syntax, DLookUp(.....) Is Null, otherwise turned out to be the
write way.

Ofer said:
Try this
If isnull(DLookUp("[Activity Name]","Details","[Activity Name] = '" &
Forms!Details![Activity Name] & "'")) Then


GT said:
In my DB I have users enter data through a form that puts the data into a
temp table before appending the data to a main table called Details. The
Details table serves as a history of all edits to a particular record. Each
record includes a field called [Activity Name]. I want to ensure that when a
new entry is created, not an edit to an existing entry, that the Activity
Name the user enters is new. I've tried using DLOOKUP in the form field
validation rule. Here is the rule code:

=DLookUp([Activity Name],"Details","[Activity Name] =
Forms!Details![Activity Name]") Is Null

I based this on the example in the Access Help. However, when the field
attempts to validated against this code, I get the following error:

There is a(n) " in the form control's ValidationRule Property.

Can anyone suggest what I've done wrong? Thanks in advance for any
assistance sent my way.

gt
 
Back
Top