If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Combobox w/query returns null value - why?
My design is pretty simple. Here it is:
table CURRENT_USER CURRENT_USER, long integer, primary_key, used to store ENTITY_IDs table ENTITY ENTITY_ID, autonumber, primary_key ENTITY_NAME, text, "last name, first name" ENTITY_EMAIL, text " ENTITY_PAGER, text currently empty query qryENTITY returns ENTITY_NAME, ENTITY_EMAIL, ENTITY_PAGER, ENTITY_ID form frmCURRENT_USER record source CURRENT_USER table combobox current_user_id control source CURRENT_USER row source qryENTITY column count 1 (ENTITY_NAME of qryENTITY) bound column 4 (ENTITY_ID of qryENTITY) I'm using no events, no code anywhere in the database, nothing like that. What I want to get is a combobox that returns the ENTITY_ID when the user can see the ENTITY_NAME. This works on several other forms I'm using, and if I use the Tables tab's data entry view I can enter a 2 and use the form to see the associated name. However when I use the combobox to pick another name the value NULL seems to be returned. I gather this because the field's value displayed changes to either all spaces or NULL and when I attempt to store that record I get a message about the value NULL not being valid for a primary key field. I know that that is a correct error, but my question is: Am I going about this the wrong way? I have several other forms with comboboxes associated with a query just like this one, several in fact that use this exact query, and they all seem to work. So, if I am going about this correctly then why is this one form's combobox returning NULL and if this is bad design overall then how should I do it? Thanks in advance for any help! Please post replies to the newsgroup. |
#2
|
|||
|
|||
Combobox w/query returns null value - why?
On Thu, 24 Jun 2004 17:32:24 -0500, james
wrote: column count 1 (ENTITY_NAME of qryENTITY) bound column 4 (ENTITY_ID of qryENTITY) That's the problem. You're returning the fourth value in the list of one. g Make the ColumnCount 4, and set the ColumnWidths property so the ENTITY_NAME is the only nonzero entry - e.g. 1.25;0;0;0. John W. Vinson[MVP] Come for live chats every Tuesday and Thursday http://go.compuserve.com/msdevapps?loc=us&access=public |
#3
|
|||
|
|||
Combobox w/query returns null value - why?
John Vinson wrote:
On Thu, 24 Jun 2004 17:32:24 -0500, james wrote: column count 1 (ENTITY_NAME of qryENTITY) bound column 4 (ENTITY_ID of qryENTITY) That's the problem. You're returning the fourth value in the list of one. g snort It does look rather silly when looked at after having the correct way explained. Make the ColumnCount 4, and set the ColumnWidths property so the ENTITY_NAME is the only nonzero entry - e.g. 1.25;0;0;0. Thanks very much! Now off to fix the same thing in lots of different comboboxes. ;v) John W. Vinson[MVP] Come for live chats every Tuesday and Thursday http://go.compuserve.com/msdevapps?loc=us&access=public |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
database design question | e-mid | Database Design | 9 | June 16th, 2004 09:42 PM |
Access inconsistencies | Hoopie | Running & Setting Up Queries | 2 | June 15th, 2004 10:53 AM |
UNION Query truncating Memo fields | Matthew DeAngelis | Running & Setting Up Queries | 4 | June 10th, 2004 02:17 PM |
combobox filter | AliKural | New Users | 7 | May 4th, 2004 11:26 AM |