Access look up field not displayed in dataGridView

mrRogers

Well-known member
Joined
Jan 23, 2016
Messages
45
Programming Experience
3-5
Using Access Lookup Wizard I created a lookup list for a field. When I bind a dataGridView to it, and when I add a new row, the lookup list does not appear. Information says the listbox appears on query datasheets that contain the field. Any idea on how to get it to display in a dataGridView ?
 
That only works in Access. Your VB app only displays what you tell it to. It won't magically display values from Access that you haven't retrieved.

Creating a lookup in your Access database is pointless unless you intend to use in Access. If your intention is to use it in a VB app only then don't bother. In VB you would have to populate a combo box column with the possible values yourself. Those options can be hard-coded in your app or they can come from another table in your Access database.

Those are basically the same choices you get for an Access lookup. If you intend to use the database in Access and in your VB app then you could create a lookup and either hard-code the options in both or use another table as the source in both.

With regards to displaying a list of options in a combo box column in a DataGridView, check this out:

Adding a ComboBox Column to a DataGridView
 
Thank, makes sense now. I only intend to use in VB app. I have done it in the past with a combo box for each field. I thought using the data Grid would have been neater.
Assuming a table exists for the look up, would you go about catching an event on the Data Grid View to open the look up and preventing only the look up selection to be entered into the cell?
 
Assuming a table exists for the look up, would you go about catching an event on the Data Grid View to open the look up and preventing only the look up selection to be entered into the cell?
I told you what to do in my previous post and I provided a link to an example that demonstrates it.
 
Back
Top