Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access
|
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 September 13th, 2009, 05:44 PM
Authorized User
 
Join Date: May 2009
Posts: 50
Thanks: 0
Thanked 0 Times in 0 Posts
Default Combo box assigned to a field not working

I have a combo box that I set up with the wizard. It is based on a table and uses the 3rd option of searching for an existing record. The wizard allows me to set up the lookup with 2 fields, Fname and Lname in my Customers table. When the selection is made, the last name appears as the result in the combo box, which is what I want.

If I assign this control (the combo box) to the last name field, when I do a lookup and make a selection from the drop down box, I get an error message that says:
You tried to call Update or CancelUpdate or attempted to update a Field in a recordset without first calling AddNew or Edit. (Error 3020)

If I keep the combo box control as unbound and have a separate bound control for last name, then it works fine. But that seems stupid to have two controls both showing the last name field, and potentially very confusing to the users.


How do I just let the entry default to the last name field in the underlying table?
 
Old September 14th, 2009, 04:19 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,151
Thanks: 2
Thanked 14 Times in 14 Posts
Send a message via ICQ to SerranoG Send a message via AIM to SerranoG
Default

Actually, Access is working exactly how it's supposed to. It's telling you that you cannot use a look-up control as a data entry control at the same time. If you try, what you're doing is every time you select an entry to LOOK UP, you're (in essence) CHANGING A RECORD at the same time. If you're sitting at a new record while you're doing it, you're then CREATING a new record.

A look-up combobox is exactly that and should not double as a data entry control.

What you CAN do is in the data entry combobox, you can place an AfterUpdate event to autofill other data entry fields based on the first and last name (although, not a good idea for someone like John Smith ).
__________________
Greg Serrano
Michigan Dept. of Environmental Quality
Air Quality Division





Similar Threads
Thread Thread Starter Forum Replies Last Post
Populate a text box from a combo box value dnf999 Access VBA 7 February 6th, 2012 02:24 PM
Combo box to display items from parent combo box Gini Visual Studio 2008 0 June 18th, 2008 12:30 AM
Count in combo box(display results in text box) mboyisis Access 4 April 4th, 2008 07:08 AM
Combo box choice creating filtered combo box stevensj5 Access 11 September 13th, 2007 11:33 AM
Populate List Box by Combo Box Selection mmcdonal Access 2 June 15th, 2004 12:08 PM





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