J
JeffH
I'm getting the follow explanation for my run time error and do not know what
is causing it. I use the same code in different forms and it works there but
not with the particular form in question.
Here is the explanation I receive:
"The macro or function set to the BeforeUpdate or Validation Rule property
for this field is preventing Database Application from saving the data in the
field.
Note: "Database Application" is the name of the Access program/application
I have designed. I also don't believe there are any validation rules on the
field for which I recieve this error message.
The code I have in the "BeforeUpdate" event for this field is as follows:
Private Sub PrimaryContact_AfterUpdate()
If DMax("CountPrimaryContacts", "qryCountPrimaryBillingContacts") > 0 Then
MsgBox "A Primary Contact has already been established for this
Billing Entity."
Me.PrimaryContact = no
Exit Sub
Else
DoCmd.SetWarnings False
DoCmd.GoToControl "PrimaryContact"
DoCmd.SetWarnings True
End If
End Sub
What the above does is runs a query to determine if there is already a
primary contact setup for a vendor. If there is a primary contact the count
will be greater than zero (0) and we want to reset the "PrimaryContract"
field to "No". If the PrimaryContact field is zero, then we want to go back
to PrimaryContact field so it can be set to "yes" if so desired.
Sorry for the explanation. I sure if you can help me this is very simple
for you.
is causing it. I use the same code in different forms and it works there but
not with the particular form in question.
Here is the explanation I receive:
"The macro or function set to the BeforeUpdate or Validation Rule property
for this field is preventing Database Application from saving the data in the
field.
Note: "Database Application" is the name of the Access program/application
I have designed. I also don't believe there are any validation rules on the
field for which I recieve this error message.
The code I have in the "BeforeUpdate" event for this field is as follows:
Private Sub PrimaryContact_AfterUpdate()
If DMax("CountPrimaryContacts", "qryCountPrimaryBillingContacts") > 0 Then
MsgBox "A Primary Contact has already been established for this
Billing Entity."
Me.PrimaryContact = no
Exit Sub
Else
DoCmd.SetWarnings False
DoCmd.GoToControl "PrimaryContact"
DoCmd.SetWarnings True
End If
End Sub
What the above does is runs a query to determine if there is already a
primary contact setup for a vendor. If there is a primary contact the count
will be greater than zero (0) and we want to reset the "PrimaryContract"
field to "No". If the PrimaryContact field is zero, then we want to go back
to PrimaryContact field so it can be set to "yes" if so desired.
Sorry for the explanation. I sure if you can help me this is very simple
for you.