Results 1 to 2 of 2
  1. #1
    Join Date
    Dec 2003
    Location
    Belfast, UK
    Posts
    87

    Unanswered: Enable/Disable control in form using table values.

    Hi,

    What I'm trying do is create 2 forms one for selecting a report and the other for running the report (will continue parameters)

    form1 (report selection) will contain:
    listbox - report name (linked to table with variables for parameters)
    ok button
    cancel button

    form2 (paramater selection) will contain:
    combobox for order
    combobox for product type
    combobox for sales area
    textbox for start date
    textbox for end date

    table (report selection)
    selection number (PK)
    report name
    report
    (the following are yes/no)
    order
    product type
    sales area
    start date
    end date

    what I want to do is when a user selects the report and clicks ok, it will look at the report selection table and if there is a yes it will enable the relevant text/combo box, if there is a no it will disable it.

    My thanks to anyone able to help with this.

  2. #2
    Join Date
    Sep 2003
    Location
    Caldes de Malavella, Spain
    Posts
    244
    From the OnClick event of your OK button on form 1 you need something like:

    If Dlookup("[Start Date]", "TblReports","ReportID = " &ListBoxName) then

    docmd.openform "Form2"

    Forms!Form2!StartDateComboName.Enabled=True

    else

    Forms!Form2!StartDateComboName.Enabled=false

    endif


    Hope this helps
    Andy Briggs
    Elmhurst Solutions Limited
    Database Development and Consultancy
    http://www.elmhurstsolutions.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
  •