p2p.wrox.com Forums

Need to download code?

View our list of code downloads.


Go Back   p2p.wrox.com Forums > Microsoft Office > Access and Access VBA > Access
I forgot my password Register Now
Register | FAQ | Members List | Calendar | 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 p2p Programmer to Programmer discussion community. This is a community of more than 40,000 computer programmers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining our free Wrox p2p community you can post your own programming questions and respond to other programmers’ questions. Registered users also don't have to see the ads that are displayed to guests. Registration is fast, simple and absolutely free so please, join today!
Join today and post to win prizes! Post more to increase your chances of being Wrox’s top poster of the month.

Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old September 13th, 2009, 06:44 PM
Authorized User
Points: 110, Level: 2
Points: 110, Level: 2 Points: 110, Level: 2 Points: 110, Level: 2
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: May 2009
Posts: 22
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?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
  #2 (permalink)  
Old September 14th, 2009, 05:19 PM
Friend of Wrox
Points: 3,645, Level: 25
Points: 3,645, Level: 25 Points: 3,645, Level: 25 Points: 3,645, Level: 25
Activity: 2%
Activity: 2% Activity: 2% Activity: 2%
 
Join Date: Jun 2003
Location: Lansing, Michigan, USA.
Posts: 1,114
Thanks: 2
Thanked 4 Times in 4 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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off
Forum Jump

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



All times are GMT -4. The time now is 06:19 AM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
© 2008 Wiley Publishing, Inc