A
Andy
Hi,
I am using Access 2003 and am building an database in Access 2000
format. I have created one table "Project Information" which holds a
number of attributes which can be set to true or false to indicate if
these attributes are to be used.
I have another table called requirements where these attributes can be
given values. I am trying to valildate on my form that values are
entered for attributes when the attribute is set to True on the Project
Information table. The initial code I have done to try this out for
just one attribute is as follows:
Private Sub Form_BeforeUpdate(Cancel As Integer)
If DLookup("[Compliance Level]", "Project Information",
"[ProjectID] = Project1") = True Then
If IsNull(Me.Compliance_Level) Or Me.Compliance_Level = "" Then
MsgBox "Must have an entry here"
Me.Compliance_Level.SetFocus
Cancel = True
Else
MsgBox "Not Null"
End If
End If
End Sub
I have the "ProjectID" hard coded at the moment while I test things out
and it is a Text field.
When I enter Debug it is highlighting the DLookup line. I'm a bit of a
newbie to Access. Could anyone please tell me where I am going wrong?
Thanks,
Andy.
I am using Access 2003 and am building an database in Access 2000
format. I have created one table "Project Information" which holds a
number of attributes which can be set to true or false to indicate if
these attributes are to be used.
I have another table called requirements where these attributes can be
given values. I am trying to valildate on my form that values are
entered for attributes when the attribute is set to True on the Project
Information table. The initial code I have done to try this out for
just one attribute is as follows:
Private Sub Form_BeforeUpdate(Cancel As Integer)
If DLookup("[Compliance Level]", "Project Information",
"[ProjectID] = Project1") = True Then
If IsNull(Me.Compliance_Level) Or Me.Compliance_Level = "" Then
MsgBox "Must have an entry here"
Me.Compliance_Level.SetFocus
Cancel = True
Else
MsgBox "Not Null"
End If
End If
End Sub
I have the "ProjectID" hard coded at the moment while I test things out
and it is a Text field.
When I enter Debug it is highlighting the DLookup line. I'm a bit of a
newbie to Access. Could anyone please tell me where I am going wrong?
Thanks,
Andy.