PDA

View Full Version : Form Templates



zennon
03-22-2007, 04:46 AM
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?

Charlize
03-22-2007, 04:56 AM
You could create a function to do such actions.

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
and in your commandbutton you sayCall action_to_do("add","Orders")Charlize

OBP
03-22-2007, 06:53 AM
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.