Use Crosstab Query for Form Recordsource

  • Thread starter LittlePhil via AccessMonster.com
  • Start date
L

LittlePhil via AccessMonster.com

Hello!

Not having much luck with this - hope someone can help.

I want to display the result of a crosstab query in a datasheet form, fixed
amount of columns, variable amount of rows.

The user is to copy the data and paste into a spreadsheet. I'm want to use a
form because i need to activate some code when the form is closed.

I'd be happy to accept any workaround - I'll keep trying and post back if i
fix it (i'm probably not at my best since its 4:30 am - Access stole my life!)


Thanks in advance,

Phil
 
G

George Nicholson

One approach:

1) create an empty subform control on a form.
2) set it's SourceObject to the xtab query either in the Properties window
or via code:
sctlQuery.SourceObject = "Query.MyCrosstab"

Note: the "Query." qualifier is required in either case.

This should display the output of your query, whatever it is, on the form in
datasheet view without worrying about the form breaking if the crosstab
output changes.

As far as displaying a fixed amount of columns, afaik, that's something you
have to control within the xtab itself (using ColumnHeadings properties,
etc.).

HTH,
 
L

LittlePhil via AccessMonster.com

Thanks for the help George, its much appreciated!

Sorry for the slow response I've been wayliad with other urgent work
throughout the week.

This works like a treat - how odd that this should work for a subform but not
a form!

Thanks again. All the best,

Phil

George said:
One approach:

1) create an empty subform control on a form.
2) set it's SourceObject to the xtab query either in the Properties window
or via code:
sctlQuery.SourceObject = "Query.MyCrosstab"

Note: the "Query." qualifier is required in either case.

This should display the output of your query, whatever it is, on the form in
datasheet view without worrying about the form breaking if the crosstab
output changes.

As far as displaying a fixed amount of columns, afaik, that's something you
have to control within the xtab itself (using ColumnHeadings properties,
etc.).

HTH,
[quoted text clipped - 16 lines]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top