Results 1 to 3 of 3

Thread: Form Help

  1. #1
    Join Date
    Dec 2003
    Location
    Arizona
    Posts
    9

    Unanswered: Form Help

    Ok, I'm back with another question. Just so everyone knows I'm trying to save money by designing my own database instead of having a "pro" come in and do it.

    I have a Table and a Form called Flight Tracking.

    The fields are: Airline, Flight Number, Arrival/Departure, Scheduled Time, Actual Time.

    OK, here's what I want to do:

    When the user opens the Flight tracking form they have to select an airline. Right now when you select an airline you have to manually go to every field to input the info, i.e. Flight number, arr/dep etc.

    How do I set the form up to when a particular airline is selected only those flight numbers that correspond to that airline show up in the drop down list for flight numbers? OK, I want to add more to this. After those flight numbers are displayed when you select a particular flight number it automatically selects whether it is an arrival or departure and also automatically selects the scheduled time for that flight number.

    Any help would be greatly appreciated

  2. #2
    Join Date
    Dec 2001
    Posts
    79
    Hi!

    If you're going to try to build the application that I think you might be trying to build, well then you may find that you will have quite a lot on your hands! Have you looked for a similar application available "off-the-shelf"??

    The short answer is that your combo box row source needs to have criteria that includes the selected airline, then needs to be requeried when the airline changes, and when the form Current event occurs.

    An easy way to do this is to create a function in a module that sets the value of the rowsource property for the combo box. Pass the function the airline ID, and return a string that is the rowsource for the combo box.

    function MyFunction(intAirlineID as integer) as string
    MyFunction = "Select MyField1, MyField2 from MyTable where AirlineID = " & intAirlineID & ";"
    end funciton

    Now you can call this function from the form AirlineID afterupdate event procedure, and from the form OnCurrent event procedure.

    Hope this helps,
    Peter De Baets
    Peter's Software - Microsoft Access Tools for Developers
    http://www.peterssoftware.com

  3. #3
    Join Date
    Dec 2001
    Posts
    79
    Oh, call the function like so:

    MyCombobox.rowsource = MyFunction(Forms!MyForm!AirlineID.value)

    Hope this helps,
    Peter De Baets
    Peter's Software - Microsoft Access Tools for Developers
    http://www.peterssoftware.com

Posting Permissions

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