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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Jump from on Private Sub to another on the same form 1

Status
Not open for further replies.

vamoose

Programmer
Oct 16, 2005
320
MX
Could someone please show me how to jump from one Private Sub to another Private Sub on the form using Access 2000 VBA. I need to go from Private Sub Command127_Click() to Private Sub Form_Open(Cancel As Integer). This is an area I have had no experience with and I can see now where it will be useful.

Thank you.
 
where it will be useful
Where ?
What do you want to do ?

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
I need to go from Private Sub Command127_Click() to Private Sub Form_Open(Cancel As Integer) both on the same form. Thank you.
 
Because there is alot of code in Private Sub Form_Open(Cancel As Integer) and I just don't want to repeat it if it's not necessary. I thought I could just jump there and re-execute the same code again and possibly save some space. When the form opens it performs a SQL query with 30 values and populates 30 combo boxes. The Private Sub Command127_Click() is a command button which I thought would take me to my existing code to refresh the query a second time. Is this not correct ?
 
So, create your own Sub doing that and call it in the event procedures you need ...

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
what you should do is creat a function that populates the combo boxes

Code:
function popcombo
.....
set me.comxx.recordset= ......
set me.comxx.recordset= ......
.......
end function


and call it from Private Sub Form_Open(Cancel As Integer) and from Private Sub Command127_Click()
 
How is it possible to set a variable to some value, call the function and still retain the value of variable for use within the function ?

Thank you.
 
Use parameters in your function.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top