If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > PC based Database Applications > Microsoft Excel > Selecting previous UserForm

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 02-18-08, 17:07
akhlaq768 akhlaq768 is offline
Registered User
 
Join Date: Oct 2007
Posts: 127
Selecting previous UserForm

I've just added a command button to my UserForm, I want it to display the previous UserForm,


and if possible to close the current form, or will that mess up the data already entered onto the form?



Private Sub CommandButton4_Click()

End Sub
Reply With Quote
  #2 (permalink)  
Old 02-18-08, 21:27
savbill savbill is offline
Registered User
 
Join Date: Feb 2004
Posts: 533
If the Sub is in the Code Module of the Userform you can refer to the form as object "Me" this will resolve to the parent form.

Private Sub CommandButton4_Click()
Me.Hide
End Sub

If the Sub is not in the Code Module of the Form you will refer to the Form Object using the Form Name.

Private Sub CommandButton4_Click()
UserForm1.Hide
End Sub

Refer to the MS Excel VB Help for the: "Hide Method", Hides an object but doesn't unload it.
__________________
~

Bill
Reply With Quote
  #3 (permalink)  
Old 02-19-08, 04:09
akhlaq768 akhlaq768 is offline
Registered User
 
Join Date: Oct 2007
Posts: 127
thanks mate
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On