Validation Rule error

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
 
G

Guest

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

Guest

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top