Compiling Written By: WisdomDude, 8/99 ----------------------------- If you're trying to compile a program, and you get "Memory over-flow" message, then you came to the right tutorial on how to fix that. This means you'll have to make a program that uses more than one .BAS file. Each .BAS file should give you at least 43k of memory. What you'll have to do is guess how much memory your program needs. Let's just say they your program needs 10k more memory. That means you'll have to make 2 .BAS files with any name. Original.BAS ' This will be the original .BAS file you created NewBAS.BAS ' This will be the copy of the original .BAS file Why do we need to have 2 duplicate .BAS files with a different name? Because we'll need to "trim" the original .BAS file and make that our "Main" .BAS file of your program. By "trimming" our original file, we'll delete half (depending on how much memory the SUBs and FUNCTIONs consume) the SUBs and FUNCTIONs in the original file and delete the other half of the SUBs and FUNCTIONs in the new .BAS file we created. here's an example on how it would look like: ------------- BEFORE ---------------------- Let's say this is Original.BAS DECLARE SUB Sub1 (with parameters or no parameters) DECLARE SUB Sub2 (with parameters or no parameters) [All your Main-Module codes] SUB Sub1 [All your Sub1 code] END SUB SUB Sub2 [All your Sub2 code] END SUB -------------------------------------------- In this case, let's just say that having 2 SUBS in one .BAS is too much! In that case, here's the After: --------------- AFTER ---------------------- Let's say this is the modified Original.BAS DECLARE SUB Sub1 (with parameters or no parameters) [All your Main-Module codes] SUB Sub1 [All your Sub1 code] END SUB Let's say this is NewBAS.BAS DECLARE SUB Sub2 (with parameters or no parameters) [Nope, you can't have main module statements in a non-main .BAS file] You'll have to move all your codes into SUBs or FUNCTIONS You can only put things like DATA/READ and DIM SHARED. but that's pretty much it for main modules for non-main BAS files. Why can't we put DECLARE, COMMON, and TYPE into the BAS files I have? Actually, you could, but there's a MUCH better way later on this tutorial. You'll put ALL your .BAS file's DECLARE, COMMON, and TYPE, END TYPE inside another file! These files are known to have an extension .BI These .BI extension files for DECLARE, TYPE, END TYPE, COMMON are much better than using DECLARE, TYPE, END TYPE, COMMON in your .BAS files! Most .BI files have these kind of things: -------------------------------------------- TYPE Property Element1 AS INTEGER Element2 AS SINGLE END TYPE DECLARE SUB Sub1 (with or without parameters) DECLARE FUNCTION Func1 (parameters or no parameters) COMMON SHARED AnyGlobalVariable And that's about it! Once you created your .BI file, then you're ready to put this statement in ALL your .BAS files you're using for your program: '$INCLUDE: 'YourNew.BI' After you put all those into your .BAS files, then you're ready to start "Loading" them into one project. Yes, you'll use that "Load File" feature for once! This will "merge" files, BUT you'll also be getting an additional 43k or more of memory for each BAS file that's in your project. Now you have .BAS files, with ALL of them sharing your BI file! After that, you'll go to SAVE ALL, and SAVE, and then when you exit, you'll notice you created a new file with the extension .MAK That right there is how QB knows what .BAS files you loaded into your project. Since you have all this, run it first. That's pretty much you need to know. Email me for more details, if you still want more info on how multiple modules.