Create a List of all tables that begin with "Random"

WinDancer

Registered User.
Local time
Today, 10:32
Joined
Oct 29, 2004
Messages
290
My application creates a table each time the user requests data.

This application also creates a copy of each table, Read-Only, for record keeping.

Each read-only table is called "Random" and the date/time the table was created.

They need to be able to copy and send the contents of any of these tables to an Excel spreadsheet.

How do I create this list for them to pick from? A form with a combop box for them to pick from would be perfect.

Thanks,
Dave
 
My application creates a table each time the user requests data.

This application also creates a copy of each table, Read-Only, for record keeping.

Each read-only table is called "Random" and the date/time the table was created.

They need to be able to copy and send the contents of any of these tables to an Excel spreadsheet.

How do I create this list for them to pick from? A form with a combop box for them to pick from would be perfect.

Thanks,
Dave

To create the material for a combo box.
Set the combobox row source type to ValueList
Use this code to create the ValueList

Code:
Private Sub Form_Open(Cancel As Integer)

Dim myList As String
Dim dbs As DAO.Database
Set dbs = CurrentDb
Dim tdfloop As TableDef
        For Each tdfloop In dbs.TableDefs
            If (Left(tdfloop.Name, 6) = "Random") Then
            myList = myList & tdfloop.Name & ";"
            End If
        Next tdfloop
        
        Debug.Print myList

End Sub

Private Sub Combo1_Click()
Me.RecordSourceQualifier = "Valuelist"   'make it a valueList
Me.RecordSource = myList                  'assign the values for the list
End Sub

The debug.print just prints the ValueList to immediate window for testing.



Does this help?
 
It does :)

And very elegant, too.

Thank you very much!
 
I am still lost. I set up the events as suggested- nothing happens, the box is empty when you click the dropdown.

I then tried to use the suggestions in the properties for the form and the field. The dropdown is still empty.

I then tried both together and still nothing.

I guess I need more info to implement...
Thanks,
Dave
 

Users who are viewing this thread

Back
Top Bottom