Directlinq
Registered User.
- Local time
- Today, 08:09
- Joined
- Sep 13, 2009
- Messages
- 67
I have a form with 6 textboxes, name, company, address, town, county, and postcode. I have a button that brings up a form with a listbox. I select a name from the listbox and it adds it and all its linked fields to the form.
The problem is i have set the address textbox as no duplicates as i dont want the same address used more than once.When i save the form it copys the entrys to the Contacts table,But as i have set the address to no duplicates i get an error. Can i not reprogram the save button to save the form but if a duplicate error comes up update the contacts table rather than create a new record.
I hope all that makes sence
here is my save button vba
Many Thanks
The problem is i have set the address textbox as no duplicates as i dont want the same address used more than once.When i save the form it copys the entrys to the Contacts table,But as i have set the address to no duplicates i get an error. Can i not reprogram the save button to save the form but if a duplicate error comes up update the contacts table rather than create a new record.
I hope all that makes sence
here is my save button vba
Code:
Set db = CurrentDb
Set rs = db.OpenRecordset("Contacts")
rs.AddNew
rs("Name") = Me![ClientName]
rs("Address") = Me![Address]
rs("Town") = Me![Town]
rs("County") = Me![County]
rs("PostalCode") = Me![PostalCode]
rs("CompanyName") = Me![CompanyName]
rs.update
Many Thanks