Hi Guys!
First post and in need of help
I have a form (frmAllCustomers) based on the table (tblAllCustomers) that displays all companies in the market with potential business for my company. When a new contract is undertaken i have a command button on frmAllCustomers that runs an append query to move the company's details into frmClients (based on tblClients).
I want to add to my code so that if the record trying to be appended from frmAllCustomers already exists in frmClients, a friendly message box appears such as "Company is already a customer!" instead of Access' Key Violation message. I've been told DLookup is the way to go. any ideas? I have something similar to this:
DLookup(["CustomerID"]["tblClient"] me.customerID)
If DLookup is = 0 Then
Run query
Else
MsgBox(Company already a customer!)
Many Thanx in advance
Andy
First post and in need of help
I have a form (frmAllCustomers) based on the table (tblAllCustomers) that displays all companies in the market with potential business for my company. When a new contract is undertaken i have a command button on frmAllCustomers that runs an append query to move the company's details into frmClients (based on tblClients).
I want to add to my code so that if the record trying to be appended from frmAllCustomers already exists in frmClients, a friendly message box appears such as "Company is already a customer!" instead of Access' Key Violation message. I've been told DLookup is the way to go. any ideas? I have something similar to this:
DLookup(["CustomerID"]["tblClient"] me.customerID)
If DLookup is = 0 Then
Run query
Else
MsgBox(Company already a customer!)
Many Thanx in advance
Andy