PDA

View Full Version : Adding a new contact to a form



wedd
09-01-2010, 06:05 AM
Is there a way once you've linked a contact or several contacts from ms outlook to a ms access linked table to ensure that a record on the form in access cannot be submitted unless a new contact is added? If so, what vba code could I use?


I appreciate the help:friends:

Imdabaum
09-01-2010, 08:48 AM
Do you mean restrict Contacts table in Access to only allow contacts that exist in your MS Outlook contacts?

wedd
09-01-2010, 12:42 PM
That's right!

Imdabaum
09-01-2010, 02:35 PM
Unfortunately I can't help you with that until I get home. I don't have Outlook or any MAPI controls installed at work. I've never actually used the Outlooks contacts as a table in my access database before. Very clever though.

Imdabaum
09-01-2010, 02:35 PM
Unfortunately I can't help you with that until I get home. I don't have Outlook or any MAPI controls installed at work. I've never actually used the Outlooks contacts as a table in my access database before. Very clever though.

geekgirlau
09-01-2010, 04:01 PM
Certainly possible, but you will need to consider a few things:

What is the trigger for refreshing the contact list? User clicks a button? On opening the database? On loading a particular form?
Depending on the size of your contact list, on updating the contacts table you will either need to scrap all records and reload, or load only new contacts and update existing ones.
All objects in Outlook have a unique identifier, so if you want to update existing contacts rather than create from scratch every time you use this to compare the records in your table against the contacts in Outlook.
Do you want to update in either direction? You probably won't want new contacts created in Access, however do you want to allow the user to update the existing values from your database and have Outlook updated automatically? Again, the unique identifier is going to be crucial for this. If not, what process will the user follow if they see incorrect details for a specific contact (how to update and then refresh the database)?There are tons of examples on this site - do an advanced search for "contact" in the Outlook forum and you'll find lots of examples to get you started.

Just had another thought - are you linking to the contacts rather than importing them? I don't have Access on site here so I can't test how easy/difficult this might be. In this case it depends on how the user is selecting the contact, but you can use properties such as limit to list to control whether they can add new options. I also suspect that if you can link to Outlook it may be somewhat like linking to Excel - you can select the data, but it's read-only.

wedd
09-02-2010, 02:30 AM
Thanks, I've linked all the new contacts in ms outlook to a table in ms access called 'contacts'. A form has been created in access to add new users...however we would like to place a restriction on users entering a new contact on our access form that doesn't appear on our contact list in ms outlook..so, in other words a new contact must be added on our outlook contacts list first, and they appear on that list they will be added onto ton our access form (new contacts). It's basically preventing the user added someone onto an access form and also having accessibility to email a new contact. Sounds straightforward but not sure that process will be that straighforward or if it's doable or very complex. Its basically a code that can see that a person is on our outlook list and if he/she is then they can be added to access...if not there will be restrictions in place to prevent them from adding that persons details directly onto access. Thanks for the suggestions.

Imdabaum
09-02-2010, 09:32 AM
....A form has been created in access to add new users..


You could just open that form in Read-Only mode so that users cannot modify the data... but that might be a cheap solution.

HannaPearson
09-07-2010, 01:06 AM
Thanks for this tip. It is very useful.

geekgirlau
09-08-2010, 04:03 PM
Actually the answer is even simpler - set the "Allow Additions" property of the form to false (might also want to set deletions and editing to false as well).