Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Forms Programming / May 2005

Tip: Looking for answers? Try searching our database.

Passing variables to Function problems

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Gibson - 09 May 2005 20:39 GMT
I am trying to pass three variables to a function. In the sub I dim each as
a string, I set them to the appropriate value then I use the the next line
to call the function Test1. The variables are of course V1,V2,V3.

Test1(V1,V2,V3)

Function Test1(str2 As String, str3 As String, str4 As String)
   code
End Function

If I use just one variable to pass it works fine. When I try to put 3 to
pass, that is to say when I put in the V2 and V3 in the calling statement I
get an error telling me a  =  is Expected.  ("Expected: =") I assume one can
pass multiple variables to a function. Can someone enlighten me.
Thanks
Paul Overway - 09 May 2005 20:48 GMT
Remove the parens...

Test1 V1,V2,V3

Signature

Paul Overway
Logico Solutions
http://www.logico-solutions.com

>I am trying to pass three variables to a function. In the sub I dim each as
>a string, I set them to the appropriate value then I use the the next line
[quoted text clipped - 11 lines]
> can pass multiple variables to a function. Can someone enlighten me.
> Thanks
Klatuu - 09 May 2005 22:01 GMT
The parens are not the problem, I don't think.  If I take your post literally
and the = Expected error is what you are getting, then you are not assigning
the value returned by Test1 to anything. Try:

WhateverKindofDataIExpect = Test1(V1,V2,V3)

> I am trying to pass three variables to a function. In the sub I dim each as
> a string, I set them to the appropriate value then I use the the next line
[quoted text clipped - 11 lines]
> pass multiple variables to a function. Can someone enlighten me.
> Thanks
Paul Overway - 09 May 2005 22:18 GMT
Yes...the parens are the problem.  He either needs to exclude them, use
Call, or assign the function return to something.

Signature

Paul Overway
Logico Solutions
http://www.logico-solutions.com

> The parens are not the problem, I don't think.  If I take your post
> literally
[quoted text clipped - 23 lines]
>> pass multiple variables to a function. Can someone enlighten me.
>> Thanks
Paul Overway - 09 May 2005 22:25 GMT
A simple test...in your immediate window

Right("whatever",1)

Then try...

Right "whatever",1

Signature

Paul Overway
Logico Solutions
http://www.logico-solutions.com

> The parens are not the problem, I don't think.  If I take your post
> literally
[quoted text clipped - 23 lines]
>> pass multiple variables to a function. Can someone enlighten me.
>> Thanks
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.