Value Lists and List Box (1 Viewer)

MatthewB

Member
Local time
Today, 06:57
Joined
Mar 30, 2022
Messages
85
I have tbl_Contractors.. I created a query to sort the table by the ServiceCategory and Company. The query is the row source for a list box. I am using this as a navigation tool. A ClickOn event populates the form fields;

txt-seviceCategory.Value = lst_ServiceContractos.Column (x)

One field is a Value list based on a related table. This seems to produce a script error "Run-time error 2113"

Is it obvious to anyone why?

Thanks
 

June7

AWF VIP
Local time
Today, 05:57
Joined
Mar 9, 2014
Messages
5,470
A combobox cannot be ValueList based on a table. Why are you using code to populate fields?

If you want to provide db for analysis, follow instructions at bottom of my post.
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 21:57
Joined
May 7, 2009
Messages
19,242
why not use a Bound form (bound to your table).
when you click on the listbox, you Find the value to your recordset.
 

GPGeorge

Grover Park George
Local time
Today, 06:57
Joined
Nov 25, 2004
Messages
1,866
I have tbl_Contractors.. I created a query to sort the table by the ServiceCategory and Company. The query is the row source for a list box. I am using this as a navigation tool. A ClickOn event populates the form fields;

txt-seviceCategory.Value = lst_ServiceContractos.Column (x)

One field is a Value list based on a related table. This seems to produce a script error "Run-time error 2113"

Is it obvious to anyone why?

Thanks
Perhaps part of the problem lies in the meanings of some of the terms you used, and how you implemented this feature.

A list box or a combo box has a row source. That is, the items shown as rows in the list or combo come from "some source".

That source can either be a table or query, or it can be a list of values you type directly into the row source property of the list or combo box.

That means when you say "Value List", we understand you to mean that you opened the property sheet and typed in each of the values you want to use as rows. When you say that "One field is a Value list based on a related table", however, that's not possible because it is EITHER a Value List OR it is a query or table. It can't be a mix of the two.

It's a bit more complicated. You ALSO have to indicate which one you want:

1648910387944.png


If you indicate "Value List", but then try to enter a SELECT statement to use records from a table, Access throws up its electronic hands and says, "Make up your mind".
 

Users who are viewing this thread

Top Bottom