moving from form to form

Mrjefferson75
01-26-2008, 09:24 PM
hi guys im trying to go from form 6 back to form 2

this is the code that runs in form 6

Private Sub Command1_Click()
If Form2.MSComm.PortOpen = True Then
Form2.MSComm.PortOpen = False

End If

If Len(Text1.Text) = 16 Then
Call PassUnlock
Else
MsgBox "Incorrect Password Size! Try again!", vbCritical
Exit Sub
End If

Form2.Enabled = True
Form6.Visible = False

End Sub


now before end sub i would think i would put

form2.show
call clean_click()

and that should bring me back to form 2 and proceed to the clean option but dosent. i get an error compile error sub or function not defined..

xer0syk0
01-27-2008, 01:18 AM
Clean_click() has to be defined in a module for it to be called from any form in your project.

Mrjefferson75
01-27-2008, 02:38 AM
it is the clean_click() works from its own button now. but its working from form2 not form6. i want it to do 2 things 1 right after the other with the click of one button. the problem is trying to get it to go from form6 to form2 to do the next function

Hugh Lerwill
01-27-2008, 03:00 AM
It sounds as if the clean_click procedure is in Form2 and that you are wanting to call it from Form6. So declare it Public in Form2

Public Sub Clean_Click(...)

Then you should be able to call it from anywhere using

Form2.Clean_Click(...)

replace my dots with arguments as/ if required.

Hugh Lerwill
01-27-2008, 03:13 AM
Alternatively calling Clean_Click in the Activate Event on Form2 may work for you.

Mrjefferson75
01-27-2008, 07:19 AM
Thanks a milllion that worked perfect.

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum