Using code to edit/add code? (1 Viewer)

Fuga

Registered User.
Local time
Today, 07:32
Joined
Feb 28, 2002
Messages
566
Hi.

My db works like this:

The user enters a "main form". Here he/she selects different y/n fields to show what he/she wants to do. Depending on this selection I want different events to take place (I call this a program). The thing is the events are pretty much the same for every user, the difference is that some of them will not require every event.

It is quite easy to divide the program into forms, where some users need to go through more than others. The problem is how do I adapt the "flow of forms" to every user so that every one gets the right forms and no more than that?

Is there a way to wright code that wrights code in the different forms, moving on to the right form after update (or whatever)? Is this a good solution when there are many users at the same time?

Or is the easiest way to make one macro for every possible combination of forms?

Or could I make a macro for each individual?

Am I going about this completely the wrong way?


Fuga.
 

doulostheou

Registered User.
Local time
Today, 00:32
Joined
Feb 8, 2002
Messages
314
Hopefully I am not way off base here on what you want, but it seems to me that all you would need to do is keep the main form open (maybe make it invisibly run in the background/just make sure that you somehow force users to close it before exiting the DB). You can then write the code on each of the separate forms with If/Then statements to run based on the information selected on the MainForm. Example:

If Forms!MainForm!YesNo = 0 Then
DoCmd.OpenForm "NoForm"
Else If Forms!MainForm!YesNo = -1 Then
DoCmd.OpenForm "YesForm"
Else
MsgBox "Something went wrong, because you shouldn't have any other choices."
End If
 

Davef28

Registered User.
Local time
Today, 06:32
Joined
Feb 6, 2002
Messages
51
I agree with doulostheou
 

Fuga

Registered User.
Local time
Today, 07:32
Joined
Feb 28, 2002
Messages
566
Thanks guys!

It is greatly appreciated. I will do it this way.


Just for the record, though, is there a way to write code that edits some other code?

Fuga.

[This message has been edited by Fuga (edited 03-06-2002).]
 

doulostheou

Registered User.
Local time
Today, 00:32
Joined
Feb 8, 2002
Messages
314
I just saw your last post. You can make your code more dynamic by referencing variables in your code. You can then change those variables in code (thus editing code with code). If you are sharing these variables across forms, they will need to be global variables.
 

Users who are viewing this thread

Top Bottom