Crosstab as Recordsource for subform(Datasheet)

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Access 97

I have a crosstab query that creates a table based on a timeframe the user
selects on a form. I would like to be able to use the created table as the
basis of a subform datasheet. The problem is that the user can select any
timeframe so that the table could have any number of columns with different
column names each time it is created. Is there a way to dynamically create
the subform or perhaps some other means of tackling this problem?

As always, thanks in advance for your help!
 
I don't know. Here is the basic code behind a combo box which displays a
list of tables and queries. The combo box Row Source is:

SELECT msysObjects.Name, msysObjects.Type, IIf([type]=1,"Table","Query") AS
TorQ
FROM msysObjects
WHERE (((msysObjects.Type) In (1,5)) AND ((Left([Name],2)) Not In
("~s","ms")));


Private Sub cboQueryName_AfterUpdate()
Select Case Me.cboQueryName.Column(1)
Case 5 'query
Me.subformctrl.SourceObject = "Query." & Me.cboQueryName
Case 1 'table
Me.subformctrl.SourceObject = "Table." & Me.cboQueryName
End Select
End Sub

Report back on your success or lack of.
--
Duane Hookom
MS Access MVP

MJatAflac said:
Thanks Duane, I looked that before I posetd but does it work in Acces 97?
 
Back
Top