Skip to content
Advertisement

It is possible to create an Subdatasheet in ODBC?

Basically, I’m trying to manage a stock warehouse, and what I’m curious about is that it is possible to implement subdatasheet inside the linked table? I have found multiple of articles regarding to this issue but some prefer another approach while another boldly claimed that it is not worth it due to performance issues.
(Im using MS Access as front end and MSSQL as backend)

Can someone clarify if you can able to create a subdatasheet inside the ODBC?

Advertisement

Answer

While you can set + use sub datasheets on linked Access tables, that feature does NOT work on linked tables to sql server.

However, what you can do is create a query on the table
(NOTE very careful: that is a query on ONE table).

then on the top most table in the query builder, you CAN define the sub-data sheet.

So, create the 2 3 or 4 tables as a simple query before you START setting up the datasheets. Note that each query can be just a “*” as the screen shot shows below.
And in the next level table, you can then also set the sub-data sheet, and so on.

So, just make sure that EACH query is against the ONE table (the linked table).

So, each query is based on the one table. You can thus work your way down.

Once the sub-data sheet is setup (don’t and can’t use “auto”) then you can get each table to expand in the UI below the next table.

So, you thus get a view like this (top most would be tours). Then a booking, a group of people to that booking, and so on.

enter image description here

So, NO JOINS in the sql. You can’t do this on the linked table(s), since the settings are read only. But, create a query on top most table. Just click on “*” for all columns. Now SAVE the table first.

when you bring the query up in design mode, you have to choose design, and THEN right click “any place” on the blank query canvas and choose properties.

eg like this:

enter image description here

So you can’t directly do this on the linked tables.

Each query is one single “base” table.
Display property sheet as per above, and then set the datasheet as per above.

So yes, you can do this with ODBC data sources in Access, but (unfortantly) you can’t use the linked tables to sql server (or Oracle or whatever). But you can build and save a query (remember to save first, then re-open). So, a saved query does support datasheets, and they work even for external ODBC data sources.

And the resulting UI above not only takes zero code, but it even allows editing of the data.

I can’t recommend this UI for end users, but for some prototyping, and a simple quick way to edit relational data without any code? Yes, the above does work.

You actually never see or even have to write any SQL for this to work.

Edit:
Ok, follow up:
The issue of course is that the above works great. Cool, but kind of the hug without the kiss.
The problem of course is now? You click on once to highlight the first query (the top most), and then in the ribbon choose under forms a data sheet.

Poof! Like magic you get a data sheet form, but no “+” to expand!

So, what to do? Ok, well, as per above, create the 3 (or however many tables you setup as queries).

Turns out you did not really need to do the 4 querys that way!!!

My bad, my sorry!
You can actualy do this with the linked tables!

How?

Ok, for the first linked table, click on (highlight). Now from ribbon create a datasheet form.

Like this:

enter image description here

Save the form.
Do this for each query.
Now the frying pan trick:
Back to top most first form. Open in design mode.

Now drag + drop from the nav pan the 2nd form (child form) onto the form in design mode.

You get a real nice mess like this:

enter image description here

Note VERY careful the property sheet for the sub form. Note the link master/child settings!!!

So, just keep dropping in the forms that way.

Try it as per above with just two froms. You find that when you flip back into datasheet mode for above, it will show the “+” and expansion just like it did for the queries.

NOTE very careful here:
You do NOT have to create the 4 queries here. You can create each form based directly on each base table. So, this saves the need to create the query for each one.
Just create a form for the first linked table.
Then a form for the 2nd linked table.

Now open up the first form in desing mode, and drag + drop on the other form.

Normally sub forms on sub-forms do NOT allow continues form views to be stacked, but datasheet forms are a exception and allow this.

The results are identical to the stacked queries, and in fact a bit less work, since the forms actually allows you to use the “builder” for the link master and child settings.

User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement