Results 1 to 2 of 2

Thread: making a dynamic form in access

  1. #1

    Thread Starter
    New Member
    Join Date
    Apr 2011
    Posts
    1

    making a dynamic form in access

    Hello

    My name is Cedric Raeymaeckers, I come from Belgium and I have a question, regarding Access. I need to make a dynamic form. The user of the form needs to have the possibilty to select the table that he wishes and then he needs to select the query that he wishes. The goal of this application, is that a user can select his table and then the right query from a list. And that the data after the query is being exported to an excel spreadsheet.

    Is this possibe? How can I integrade a list in my form, where the user has a choise between every table in the access database.

    Sorry for my bad english, but normally I speak dutch.

    Thanks in advance

    Greetings from Belgium

  2. #2
    Fanatic Member dmaruca's Avatar
    Join Date
    May 2006
    Location
    Jacksonville, FL
    Posts
    577

    Re: making a dynamic form in access

    Access doesn't have a query that does this as far as I'm aware. You can do this with code using the form's load event.

    Code:
    Private Sub Form_Load()
        Dim tdf As TableDef
        
        Combo0.RowSourceType = "Value List"
        For Each tdf In CurrentDb.TableDefs
            'Comment out the table types you don't want to add
            'See http://support.microsoft.com/kb/210362
            If tdf.Attributes And dbAttachedODBC Then Combo0.AddItem tdf.Name
            If tdf.Attributes And dbAttachedTable Then Combo0.AddItem tdf.Name
            If tdf.Attributes And dbAttachExclusive Then Combo0.AddItem tdf.Name
            If tdf.Attributes And dbAttachSavePWD Then Combo0.AddItem tdf.Name
            If tdf.Attributes And dbHiddenObject Then Combo0.AddItem tdf.Name
            If tdf.Attributes And dbSystemObject Then Combo0.AddItem tdf.Name
            'This next one is for "normal" tables with no attributes.
            'Probably the only ones you want.
            If tdf.Attributes = 0 Then Combo0.AddItem tdf.Name
        Next
    End Sub

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width