Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Running Code From Controls On Other Forms

As I am not allowed to use Access for a project, I am having to mak
Exce2002 work/look like Access.

My utility is basically just a load of forms with commandbuttons, tex
and listboxes where values entered/selected are placed into th
woksheets behind the forms where formulas calculate values. Onc
calculated, the totals values are entered into tables below
like an entry in a datasheet view

The whole utility works fine in standard manual entry mode, but I no
need to setup an option where I can click one commandbutton and it wil
go off and open each form in turn, enter the relevant values (and s
enter into the worksheets and let the formulas calculate), and then ru
the commandbutton on each form that adds the values to the relevan
table below. I can't get it to work.

Here's an example of the code

frmRMSelected.Show
Run frmRMSelected.cmdRMAdd
frmRoadmap.txtRMItemDesc = itemdesc
frmRoadmap.txtRMItemNo = "12"
Run frmRoadmap.cmdRMSaveNew
Me.Hide

I originally tried to invoke the Click Event (without Run) of th
commandbuttons but no joy.

This code is supposed to show the frmRMSelected form and then click o
the cmdRMAdd button to initiate it's code. It does the rest but ignore
the "Run " lines

My only option at present is to put all the code from all the form
into one funcvtion and run that. That would be massive and messy.

Any ideas ASAP please?

Thanks

Barr

--
Message posted from http://www.ExcelForum.com

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Running Code From Controls On Other Forms

I think it would be messier writing the code to populate the boxes, then
executing a click event just to reuse your code. Sounds like you just need
to reorganize, rewrite your procedures to facilite the functionality you
need.

--
Regards,
Tom Ogilvy




"bazman1uk " wrote in message
...
As I am not allowed to use Access for a project, I am having to make
Exce2002 work/look like Access.

My utility is basically just a load of forms with commandbuttons, text
and listboxes where values entered/selected are placed into the
woksheets behind the forms where formulas calculate values. Once
calculated, the totals values are entered into tables below
like an entry in a datasheet view

The whole utility works fine in standard manual entry mode, but I now
need to setup an option where I can click one commandbutton and it will
go off and open each form in turn, enter the relevant values (and so
enter into the worksheets and let the formulas calculate), and then run
the commandbutton on each form that adds the values to the relevant
table below. I can't get it to work.

Here's an example of the code

frmRMSelected.Show
Run frmRMSelected.cmdRMAdd
frmRoadmap.txtRMItemDesc = itemdesc
frmRoadmap.txtRMItemNo = "12"
Run frmRoadmap.cmdRMSaveNew
Me.Hide

I originally tried to invoke the Click Event (without Run) of the
commandbuttons but no joy.

This code is supposed to show the frmRMSelected form and then click on
the cmdRMAdd button to initiate it's code. It does the rest but ignores
the "Run " lines

My only option at present is to put all the code from all the forms
into one funcvtion and run that. That would be massive and messy.

Any ideas ASAP please?

Thanks

Barry


---
Message posted from http://www.ExcelForum.com/



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Running Code From Controls On Other Forms

Tom,

Is not so much the problem of putting the vlues in the boxes. That wok
OK. It's running the code of the command buttons.

I need to be able to do this.

From say Form1

Click on Form1.commandbutton1

This then opens Form2
Runs Form2.commandbutton1
then run Fom2.commandbutton2
then hides Form2

I effectively want the code of Form1.commandbutton1 to be somethin
like this.

Private Sub commandbutton1_Click()

Form2.Show
Form2.commandbutton1_Click
Form2.commandbutton2_Click
Form2.Hide

End Sub

Ba

--
Message posted from http://www.ExcelForum.com

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Running Code From Controls On Other Forms

You don't need to show form2 and in fact, that would stop your code from
executing. In form2 you would have to make all the event code Public rather
than private

Private Sub commandbutton1_Click()

Load Form2
Form2.commandbutton1_Click
Form2.commandbutton2_Click
Unload Form2
End Sub

--
Regards,
Tom Ogilvy


"bazman1uk " wrote in message
...
Tom,

Is not so much the problem of putting the vlues in the boxes. That woks
OK. It's running the code of the command buttons.

I need to be able to do this.

From say Form1

Click on Form1.commandbutton1

This then opens Form2
Runs Form2.commandbutton1
then run Fom2.commandbutton2
then hides Form2

I effectively want the code of Form1.commandbutton1 to be something
like this.

Private Sub commandbutton1_Click()

Form2.Show
Form2.commandbutton1_Click
Form2.commandbutton2_Click
Form2.Hide

End Sub

Baz


---
Message posted from http://www.ExcelForum.com/



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
ActiveX to Forms controls Sian Excel Discussion (Misc queries) 2 January 31st 08 12:22 AM
Excel forms controls [email protected] Excel Discussion (Misc queries) 1 March 18th 07 04:37 AM
Questions about Forms & Controls hmm Excel Discussion (Misc queries) 3 December 20th 06 01:06 PM
Forms controls Catalin Excel Worksheet Functions 2 May 11th 06 03:44 PM
Forms Controls Chuck Taylor Excel Programming 2 December 1st 03 01:42 PM


All times are GMT +1. The time now is 12:36 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"