John Clark
John.Clark at niagaracounty.com
Fri May 7 13:59:26 CDT 2004
Thanks for the tip on this. I hadn't know it worked this way. Using 'functions' over 'subs' is a habit that I obviously need to break. I think I get this from learning other lanquages, years ago, which used functions or procedures. They were mostly OOP. Thanks to everybody who donated their thoughts to this. As usual, I ask for help, and I not only get it, but I learn something along the way. Thanks again everybody!!! John W Clark >>> Lambert.Heenan at aig.com 5/6/2004 4:26:04 PM >>> Shame you did not quote the actual line of code that's giving the error, but I think I've worked it out anyway. You can "Call" a function in (at least) 3 ways 1/ x = FunctionName(parameters...) 2/ FunctionName parameters... and 3/ Call FunctionName(parameters...) Only the first one actually used the return value of the function, the other two are examples of using a function as a Sub. So if your code looks like this x = SeeDateInfo(True, 1) then it will run just fine and you'll get a return value in x, but if the code looks like this SeeDateInfo(True, 1) then you will get the compile error "Expected =" as you are not using the return value yet you are using the function call syntax. If you don't want the return value then call it like this Call SeeDateInfo(True, 1) or SeeDateInfo True, 1 Oddly enough, you do not get this error when you call a function with only one argument using the "wrong" syntax. Lambert > -----Original Message----- > From: John Clark [SMTP:John.Clark at niagaracounty.com] > Sent: Thursday, May 06, 2004 3:05 PM > To: accessd at databaseadvisors.com > Subject: [AccessD] Problem adding a param. to a function > > OK...this is probably something boneheaded and simple, but I haven't > posted any problems in a while, and my head feels like it is going to > explode from behind my eye sockets, so please bare with me... > > I have been asked to do some alterations/additions to a program that I > wrote, a little over a year ago. What I am working on now is the simple > addition of a new report. I usually leave some 'reserved' buttons on my > Reports Menu because they always want more reports, so the buttons are > already there. > > On my reports menu, I have hidden fields to accomodate a couple of the > different reports. These fields become visible, depending on the report > chosen--I have one that uses 'Start Date' and an 'End Date' fields, and > another that uses a drop-down to choose an employee. These also each > have a cancel button, and a proceed button. After you cancel or proceed, > the main buttons, which were disabled, when one was chosen, are > re-enabled, and the used fields become invisible again. > > This report that I have added is also dependent on a starting and > ending date, so I used the same function to do the button magic (i.e. > disappear, reappear, setfocus, enable, etc.). However I needed an extra > IF statement to decipher which of two buttons was chosen. So I added the > if statement and added a parameter to go with it: > > Function SeeDateInfo(Mode As Boolean) > > has become > > Function SeeDateInfo(Mode As Boolean, Button As Integer) > > but when I change the function call to add another parameter, the help > tip comes up correctly--it tells me what it is looking for--but I get an > error: Compile Error ... Expected: = > > What in the hey am I doing wrong?! > > Thanks for the help...now and in the past! > > I gotta fly now to get my daughter's tooth yanked...arrrrghtt!!! > > btw...A97 > > John W Clark > -- > _______________________________________________ > AccessD mailing list > AccessD at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/accessd > Website: http://www.databaseadvisors.com -- _______________________________________________ AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com