A
ArielZusya
I've recently discovered the joy of modules (as apposed to embedded VBA
associated with each form). I'm only just beginning to understand the full
richness of modules. For the most part I've discoverd that I can take some
of my more simple yet repetative code and place it in a module. For example,
Where I would before have a button that calls code that closes the current
form and opens a seperate form, I can place the code in a module and have the
name of the module be called from the form but with the name of the new form
passed to the module in parenthesis. So, if my CloseThisAndOpenThat function
takes stDocName as a variable in the module it would have
Public Sub CloseThisAndOpenThat (stDocName As String)
and then in the code for the button on the form it would have
CloseThisAndOpenThat ("frmSecondForm")
All of that works fantastically. Trouble is I'd like to do something
similar but passing more variables. If, in my module I have something like:
Public Sub CloseThisAndOpenThat (stDocName As String, _
stQueryText As String, lnOptSelection As Long)
and then try
CloseThisAndOpenThat("frmSecondForm", "where tblMain.Issue1 = 1", 2)
I get an "expected =" error. What am I doing wrong? Thanks for your help!
Ariel
associated with each form). I'm only just beginning to understand the full
richness of modules. For the most part I've discoverd that I can take some
of my more simple yet repetative code and place it in a module. For example,
Where I would before have a button that calls code that closes the current
form and opens a seperate form, I can place the code in a module and have the
name of the module be called from the form but with the name of the new form
passed to the module in parenthesis. So, if my CloseThisAndOpenThat function
takes stDocName as a variable in the module it would have
Public Sub CloseThisAndOpenThat (stDocName As String)
and then in the code for the button on the form it would have
CloseThisAndOpenThat ("frmSecondForm")
All of that works fantastically. Trouble is I'd like to do something
similar but passing more variables. If, in my module I have something like:
Public Sub CloseThisAndOpenThat (stDocName As String, _
stQueryText As String, lnOptSelection As Long)
and then try
CloseThisAndOpenThat("frmSecondForm", "where tblMain.Issue1 = 1", 2)
I get an "expected =" error. What am I doing wrong? Thanks for your help!
Ariel