I'm not very experienced but in order to do that, I put a DataControl on my form, link the datagrid to it and set the DataControl.RecordSource property to the right SQL statement... including the different required tables. (e.g. "SELECT * FROM EMP, DEPT WHERE EMP.DEPTNO=DEPT.DEPTNO... ..."
Then I click on the "Custom" property of the datagrid, go to the 'Columns' tab, select the right column and set its Datafield property to the name of the field in the table of your choice (you can edit it without using the associated combobox).
(e.g. : DEPT_NAME)
I have a table (table #1) that populates all my textboxes and shows other data in the grid. For example, I have an account #, which has several sub-accounts attached to it. I display the general information of the account in my textboxes (address, customer name, etc.) and the sub-account information in the grid (sub-account #, date opened, etc).
I add this information to another table (table #2). But I also include whether or not the sub-account is active, by a boolean value (Yes/No) that the user can select directly on the grid. This field is on table #2, not on table #1.
When I try to select Yes/No, I get a "column not found" error. I know this is because the grid's datasource is table #1 and not tablr #2. The grid's datasource is not the same datasource as the Yes/No column. But I need it to work!!! Why? Because I insert the information in the datagrid into table #2, including the Yes/No values. Plus my grid is multiselect, so I can insert several rows on the same click (at least that's what my user is going to see...)
So, using a query to "tie" up table #1 and table #2 is not going to work, because it is possible that there is no data on table #2, or the data is being inserted and not updated.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.