Dynamically Creating a form

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Jimmer

    Dynamically Creating a form

    How does one create/change a form on the fly?

    I have a situation where I would like the user to be able to determine
    the fields they view and how the data is grouped at runtime.

    For example, the form might list Company Name, Last Name, Address,
    Phone Number, Accounts Payable $ on time and Last Name, Address, Phone
    Number, Social Security, Accounts Payable $ the next and Company Name
    and Accounts Payable $ the time after that. Each one of course would
    provide different totals with respect to accounts payable?

    I've tried to list all of the possible fields on the form, change the
    record source data to get the proper grouping and then simply "hide"
    the fields I don't need but this doesn't work in datasheet view. I
    can't hide (ie. affect the visible property) the fields and simply get
    an error in the field because the new recordsource does not contain
    the unwanted field.

    Thanks.
  • Albert D. Kallal

    #2
    Re: Dynamically Creating a form

    What you can do, is simply place the common fields (text box controls) on
    the form.

    Then, have several "extra" text boxes that are UN-BOUND. You can simply set
    the CONTROL SOURCE of each text box to the field you want it to edit.

    me.txtContorl1. ContorlSouce = "Company"

    The above would thus make the text box contorl1 edit the company field. You
    can do this setup of code in the forms on-load event.

    --
    Albert D. Kallal (Access MVP)
    Edmonton, Alberta Canada
    pleaseNOOSpamKa llal@msn.com



    Comment

    • Jimmer

      #3
      Re: Dynamically Creating a form

      Thanks Albert, unfortunately, this doesn't work. The form is in
      datasheet view and while I can control the content by doing this, the
      "empty" columns still appear on the forms, regardless of the visible
      property.

      Regards.



      "Albert D. Kallal" <PleaseNOOOsPAM Mkallal@msn.com > wrote in message news:<0F8Vc.153 170$J06.58467@p d7tw2no>...[color=blue]
      > What you can do, is simply place the common fields (text box controls) on
      > the form.
      >
      > Then, have several "extra" text boxes that are UN-BOUND. You can simply set
      > the CONTROL SOURCE of each text box to the field you want it to edit.
      >
      > me.txtContorl1. ContorlSouce = "Company"
      >
      > The above would thus make the text box contorl1 edit the company field. You
      > can do this setup of code in the forms on-load event.[/color]

      Comment

      • Albert D. Kallal

        #4
        Re: Dynamically Creating a form

        Use a continues form...and not datasheet view....users will likely never
        know the difference...


        --
        Albert D. Kallal (Access MVP)
        Edmonton, Alberta Canada
        pleaseNOOSpamKa llal@msn.com



        Comment

        • Jimmer

          #5
          Re: Dynamically Creating a form

          Thanks,

          Works like a charm.

          Jim.


          "Albert D. Kallal" <PleaseNOOOsPAM Mkallal@msn.com > wrote in message news:<RfbWc.180 182$M95.30766@p d7tw1no>...[color=blue]
          > Use a continues form...and not datasheet view....users will likely never
          > know the difference...[/color]

          Comment

          Working...