Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

linking forms 2

Status
Not open for further replies.

baha

Programmer
Apr 16, 2002
28
US
Hi,

I have a little problem linking tables. Yesterday i asked about linking them, and now i know how to do it, but i have another problem. I linked main form with another form:

Main Sub mnuSales_Click()

frmSales.show
frmMain.hide

end sub
It looks like that, I put hide command for main form becaouse i wanted it to hide, but it does not do it. Two forms stay and when i try to close main form it reappears again, and i can not use second form at all, the main form keeps itself activated all the time.
I compiled the program and run it, I could not close the main form at all, it kept reapearing.
Main form does not have any coding exept the one i showed, maybe something in properties?
Please help me, maybe i have to use another codes.

Thanks


 
perhaps if you were to post your code, we might be able to provide additional help Good Luck
------------
Select * from Users where Clue > 0
0 rows returned
 
Hi, Here is the codes i have

First commes Splash Form I just added timer, so it will switch to Main form.
Here is the code:

Option Explicit

Private Sub Form_KeyPress(KeyAscii As Integer)
Unload Me

End Sub

Private Sub Form_Load()
lblVersion.Caption = "Version " & App.Major & "." & App.Minor & "." & App.Revision
lblProductName.Caption = App.Title

End Sub

Private Sub Frame1_Click()
Unload Me

End Sub

Private Sub Timer1_Timer()
frmMain.Show
frmSplash.Hide
End Sub


Here is the Main Form, I have menu button, which should switch to Sales Form:

Option Explicit

Private Sub mnuSale_Click()
frmSales.Show
frmMain.Hide

End Sub

That is it.
Thanks
 
i'm not exactly sure which code goes to which form, however, i think i have possible solution for u.

the reason why the main form keeps on reappearing is because at every interval (however long your interval is) the timer code runs and shows the main form.

the reason why the timer function keeps on runnings i b/c u didnt unload the main form, u only hid it
unload it and it should work,...

if that doesnt work, put down which code goes to which form and i'll try to help u.

Sam
 
I several things that you might want to address:

On the spash screen, if you enter a keystroke, or click on the frame before the timer event fires, the splash screen gets unloaded without the main form ever being loaded.

If you do nothing, then the timer event will fire which causes the main form to load, and the splash screen to hide. But just because the form is hidden, doesnt mean that the timer is inactive. Therefore, the timer event will fire again at the designated interval, causing the main form to again be shown. And no matter what you do, after every interval, frmMain will be shown.

I would suggest changing the splash screen code to the following:

Option Explicit

Private Sub Form_KeyPress(KeyAscii As Integer)
Unload Me
End Sub

Private Sub Form_Load()
lblVersion.Caption = "Version " & App.Major & "." & App.Minor & "." & App.Revision
lblProductName.Caption = App.Title
End Sub

Private Sub Form_Unload(Cancel As Integer)
frmMain.Show
End Sub

Private Sub Frame1_Click()
Unload Me
End Sub

Private Sub Timer1_Timer()
timer1.enabled = false
Unload me
End Sub






Good Luck
------------
Select * from Users where Clue > 0
0 rows returned
 
Thanks very much, it worked.

That was the timer, i just added unload me command in the Splash form codding, and i deleted hide command for splash form.
Like that:

Private Sub Timer1_Timer()
frmMain.Show
Unload me
End Sub

and it is working. Thanks

I am learning on my mistakes:)
 
Unless you also changed the Frame_Click and Key_Press events, you may still have a startup problem as previously described
Good Luck
------------
Select * from Users where Clue > 0
0 rows returned
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top