L
lmcc007
First of all, I am not sure how to ask this question. But, this is what I am
trying to do: I do not want the same phone type per company. If I choose,
for example, Fax as the phone type twice, I want a message to display saying
to choose another phone type. I entered the code below, but keep getting an
error:
Private Sub PhoneTypeID_BeforeUpdate(Cancel As Integer)
If Me.CompanyID And Me.PhoneTypeID <> Me.PhoneTypeID Then
Me.PhoneTypeID
Else
MsgBox "Choose another phone type.", vbCritical, "Phone Type"
End If
End Sub
The error highlights Me.PhoneTypeID then give this error: Compile Error
Invalid use of property.
Then I tried putting the validation rule on a control in form design view.
I tried this:
=DLookUp("PhoneTypeID","Telephone","PhoneTypeID =
Forms!frmTelephone!PhoneTypeID") Is Null
The problem is it is not requiring it a unique PhoneTypeID per company. It
is doing it for the entire table.
I know I am missing something, but haven’t been able to figure it out.
Thanks!
trying to do: I do not want the same phone type per company. If I choose,
for example, Fax as the phone type twice, I want a message to display saying
to choose another phone type. I entered the code below, but keep getting an
error:
Private Sub PhoneTypeID_BeforeUpdate(Cancel As Integer)
If Me.CompanyID And Me.PhoneTypeID <> Me.PhoneTypeID Then
Me.PhoneTypeID
Else
MsgBox "Choose another phone type.", vbCritical, "Phone Type"
End If
End Sub
The error highlights Me.PhoneTypeID then give this error: Compile Error
Invalid use of property.
Then I tried putting the validation rule on a control in form design view.
I tried this:
=DLookUp("PhoneTypeID","Telephone","PhoneTypeID =
Forms!frmTelephone!PhoneTypeID") Is Null
The problem is it is not requiring it a unique PhoneTypeID per company. It
is doing it for the entire table.
I know I am missing something, but haven’t been able to figure it out.
Thanks!