Results 1 to 8 of 8

Thread: Form question

  1. #1
    Join Date
    Aug 2007
    Posts
    4

    Exclamation Unanswered: Form question

    I have an Access DB that has two forms for input. Each of the two forms modify two different tables they are associated with. What I would like to do is have 1 form with a drop down that will allow for me to select one of two options and it will update the form for entry to that specific table. Im logging hours in flight or days by ground. (Transportation). Right now everything is done with two forms and two tables. I'm pretty sure this can be achieved with one form.


    Any help would be appreciated.


    Ben

  2. #2
    Join Date
    Jul 2003
    Location
    Michigan
    Posts
    1,941
    Sounds like the two forms are already very similar. Are the tables related in any way? Are they very similar to each other, also?
    Inspiration Through Fermentation

  3. #3
    Join Date
    Dec 2004
    Location
    Madison, WI
    Posts
    3,926
    Sure, a couple of suggestions...Design 1 main form and just put each of the 2 subforms in it
    or
    design 1 main form with a combobox and a blank subform. In the combobox AfterUpdate event set the sourceobject of the subform to which ever form you want depending on what is selected in the combobox (or you can also have an option group, buttons, etc.)...
    ie...
    Private Sub myComboboxName_AfterUpdate()
    if me!MyComboboxName = "Subform1Name" then
    me.mysubform.sourceobject = "nameofsubform1"
    else
    me.mysubform.sourceobject = "nameofsubform2"
    end if
    End Sub
    Expert Database Programming
    MSAccess since 1.0, SQL Server since 6.5, Visual Basic (5.0, 6.0)

  4. #4
    Join Date
    Dec 2004
    Location
    Madison, WI
    Posts
    3,926
    I posted as the same time as RedNeckGeek. He's right in asking if the subforms are related in any way.
    Expert Database Programming
    MSAccess since 1.0, SQL Server since 6.5, Visual Basic (5.0, 6.0)

  5. #5
    Join Date
    Aug 2007
    Posts
    4
    The two forms are Identical except one keeps track of hours and the other keeps track of days. I guess thats pretty much the same thing. I'm going to poke around with Paul's scenario and see if that works. Im open to any new suggestions! Thanks everyone!

  6. #6
    Join Date
    Jul 2003
    Location
    Michigan
    Posts
    1,941
    I don't know a whole lot about your app, but what I'm going after is...

    Could you merge the data in your tables, possibly adding 1 column to indicate "hours" or "days", and then you just need one form with a filter.
    Inspiration Through Fermentation

  7. #7
    Join Date
    Aug 2007
    Posts
    4
    I have a solution to so everyone can get an idea of what is going on. I'll attach a demo DB that is basically what I'm talking about. Minus what I still need of course. WELL not attached... heres a link to the file...

    http://benmcgraw.com/db.zip

    Thanks again for all of the help!!! This is the most responsive forum I've been in. From actionscripting to .net this one is really quick!!!

  8. #8
    Join Date
    Aug 2007
    Posts
    4
    I went ahead and implemented the below solution. Thanks for your help!

    -Ben

    Quote Originally Posted by pkstormy
    Sure, a couple of suggestions...Design 1 main form and just put each of the 2 subforms in it
    or
    design 1 main form with a combobox and a blank subform. In the combobox AfterUpdate event set the sourceobject of the subform to which ever form you want depending on what is selected in the combobox (or you can also have an option group, buttons, etc.)...
    ie...
    Private Sub myComboboxName_AfterUpdate()
    if me!MyComboboxName = "Subform1Name" then
    me.mysubform.sourceobject = "nameofsubform1"
    else
    me.mysubform.sourceobject = "nameofsubform2"
    end if
    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
  •