Hi,

On my form I have 3 buttons - Biology, Physics, Chemistry. There is also another button, cmddiagram. If and when clicked this will give a form2 with a diagram of the topic in question : if biology is clicked, then it gives a diagram on biology, if physics is clicked...etc

Okay, the problem is that there is only one diagram button, and it can only show one particular diagram at a time - biology, physics or chemistry (depending on which of these has been clicked).

So I plan putting the code for each in a module. The buttons have code as follows:

Private sub cmdBiology_click()
Call Biology
end sub


Private sub cmdPhysics_click()
Call Physics
end sub


Private sub Chemistry()
Call Chemistry
end sub


My problem is, though, that I don't know how to fit the cmddiagram into all this. In my module, for instance, I have:

Public sub Biology()
'I don't know what code goes here, something
'like: if cmddiagram clicked = true Then
Form2!Show
Form2!Controls.Add "VB.line", "line1"
Form2!line1.X1 = 1560
Form2!line1.X2 = 1560
Form2!line1.Y1 = 1800
Form2!line1.Y2 = 4800
Form2!line1.Visible = True
End Sub


Any help or advice on this topic would be appreciated.