Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
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
  #1 (permalink)  
Old January 8th, 2008, 12:23 PM
Registered User
 
Join Date: Nov 2007
Location: Boynton Beach, FL, USA.
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default Updating Field in Form

This seems so simple and yet I can't get it to work no matter what I try. Maybe someone can suggest something.

I have a form for data entry into a table. On this form there is a combo box used to select a project number from another table. The table contains project numbers and their names. I would like to display the name of the project in another control.

I have tried using DLookup() in the Control Source field of the control, but that didn't work.

I then added the DLookup() function to the after update event of the Project Number combo box and when the Project Number was changed it updated the Project Name box, but it didn't update it when moving from record to record.

I tried adding the DLookup() function to several other event routines, but it still didn't update it when changing records.

I then tried using a query with [Forms]![Enter Task].[Combo51] as the criteria (Combo51 is the Project Number combo box). The query produces the correct results when standing alone, but when I use the query as the data source #Name? apears in the Project Name box on the form.

I'm running out of things to try, so if anyone has any suggestions, I would appreciate it.

Thanks,

Charlie
  #2 (permalink)  
Old January 8th, 2008, 02:42 PM
Friend of Wrox
Points: 9,611, Level: 42
Points: 9,611, Level: 42 Points: 9,611, Level: 42 Points: 9,611, Level: 42
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Mar 2004
Location: Washington, DC, USA.
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts
Default

Did you put the DLookup() on the On Current Event of the Form? The combo should also be synched on the On Current Event.

Normally I would do this with a combo look up (made with the wizard) on the On Current Event:

Combo0 = ProductID

As an example.

If you synch the combo this way, then run the DLookup() right after, that might work.

mmcdonal

Look it up at: http://wrox.books24x7.com
  #3 (permalink)  
Old January 8th, 2008, 03:37 PM
Registered User
 
Join Date: Nov 2007
Location: Boynton Beach, FL, USA.
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I knew there had to be an event I was missing! That did the trick. Thanks for your help.


Charlie


Similar Threads
Thread Thread Starter Forum Replies Last Post
Error on updating the date field surya MySQL 2 September 16th, 2008 11:56 PM
Updating Last_Updated Field arholly Access 4 January 17th, 2007 12:05 PM
Updating a Date field based on another field arholly Access VBA 6 November 22nd, 2006 11:19 AM
Updating a field using a SELECT statement? katie123 Access VBA 1 April 12th, 2006 10:23 AM
Referring to a field and updating Programmatically vmerc Access VBA 4 January 12th, 2006 10:28 AM





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