Wrox Programmer Forums
Access Discussion of Microsoft Access database design and programming. See also the forums for Access ASP and Access VBA.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old May 27th, 2007, 03:41 PM
Authorized User
Join Date: Apr 2007
Posts: 65
Thanks: 0
Thanked 0 Times in 0 Posts
Default Contact Insertion Issue

Ok, I'm having an issue trying to insert a contacts' last name, first name and phone number into the parent form.

If you were able to open the db, when double-clicking on "frmTask", at the bottom there is a Listbox called "Pick-Up Contact" / List87 respectively. When you double-click on that list box, it'll open the form, "frmSearchContact". Here a user can search for a contact name and phone number to call when the task is completed and ready for pick-up by the originating organization. THIS WORKS FINE, even returns the results and all.

What I'm trying to do is when the user searches for someone, like if you type in "T", it'll pull up a contact name, when the user finds the person needed, they then will double-click on it in the list box on that form, "frmSearchContact", this will then input the LastName, FirstName, Phone of that particular contact into the listbox on the parent form, "frmTask".

That's what I can't figure out.

Thanks for the help,


Old May 30th, 2007, 06:56 AM
Friend of Wrox
Join Date: Mar 2004
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts

Here is what you do.

Create a query that gets the first name, last name and contact info you want, then create a continuous form to display it. Then in the criteria field of the last name field in the query, put this:

Like [Please enter the first few letters of the contact's last name"] & "*"

Then create a button on the main form that says "Search for Contact by Last Name" that opens the continuous form. When this is clicked, the parameter prompt will fire from the query, and that will pop up asking for the first few letters of the contact's last name.

In the coninuous form, put a button in the detail section (when the form is run there will be a button for each record) that says "Use this Contact information" or something like that.

Then on the On Click event of the button on the continous form, put something like this:

Public sFirst, sLast, sPhone, sContact As String

sFirst = Me.FirstName
sLast = Me.LastName
sPhone = Me.Phone

sContact = sLast & ", " & sFirst & ": " & sPhone

[Forms]![frmYourOtherForm].[Contact] = sContact


This will post the contact info to the originating form (which should still be open) and close the continuous form.

Did that work?

Old May 30th, 2007, 09:17 AM
Authorized User
Join Date: Apr 2007
Posts: 65
Thanks: 0
Thanked 0 Times in 0 Posts

I got it to work! Had to make the "ContactID" field show on the main form, then set the 'double-click' event on the list box to open the search contact form. Ran a query for the list box to search using the data entered into a text box. Then set the double-click property of the list box on the search page to push / pass the information (ContactID [pk]) back to the main form's ContactID field. Then the property of the list box was set to a query to pull the first name, last name and phone of that contact ID back into the field.

Works like a charm!

Similar Threads
Thread Thread Starter Forum Replies Last Post
Contact Form and Gmail Jamessaep BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 5 April 16th, 2008 07:58 AM
Add Contact nileshpatel Classic ASP Components 0 March 10th, 2007 01:50 AM
Contact Selectot in InfoPath anandhienator Infopath 0 February 19th, 2007 05:07 AM
Contact Form myself Classic ASP Basics 1 November 18th, 2006 11:16 AM
PHP contact form probe4 PHP How-To 1 September 14th, 2005 12:52 PM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.