Consulting

Results 1 to 3 of 3

Thread: Form Templates

  1. #1
    VBAX Regular
    Joined
    Feb 2007
    Posts
    20
    Location

    Form Templates

    Is it possible to create a form template that has the same buttons and same code behind it.

    For example. I have about 10 forms which are inputs into various tables. The forms all contain buttons which all perform the same functions, for example add, print, delete etc.

    Is it possible to create a collection of buttons which I can invoke on each form withouth having to recreate the buttonset?

  2. #2
    VBAX Master
    Joined
    Jul 2006
    Location
    Belgium
    Posts
    1,285
    Location
    You could create a function to do such actions.
    [vba]
    Sub Function action_to_do(vaction as string, vtable as string)
    Select Case vaction
    Case "add"
    code to insert to vtable
    Case "delete"
    code to delete record from vtable
    Case "modify"
    code to update record from vtable
    end case
    End Function[/vba]
    and in your commandbutton you say[vba]Call action_to_do("add","Orders")[/vba]Charlize

  3. #3
    VBAX Guru
    Joined
    Mar 2005
    Posts
    3,297
    Location
    It is not necessary to use any VBA.
    In the Forms section just copy the curent form and paste it with a new name.
    All you have to do now is change the Data Source for the new form and it's fields.

Posting Permissions

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