Microsoft Access Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 



Go Back   Dev Articles Community ForumsDatabasesMicrosoft Access Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old March 21st, 2005, 10:49 AM
helz helz is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Mar 2005
Posts: 5 helz User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 24 m 30 sec
Reputation Power: 0
VBA: Custom function without parameter giving Expected = error

I have two functions, one with a parameter and one without
eg:
Code:
 Public Sub FuncWParam(state as boolean)
    'some code here
 End Sub
 
 Public Sub FuncWOParam()
    'some code here
 End Sub
 

Now I can call the function with a parameter like this:
Code:
 FuncWParam (1)
 

but if i try calling the function that does not have a parameter i get an error
Code:
 FuncWOParam()
 

error is:
Expected: =
so i tried giving the function a return value into a variable but then i get the error
Expected: Function or Variable

any ideas?

PS. Another idea I had was, can i use a variables value in a statement? ie somthing similar to:
Code:
 Public Sub ClearObject(obj as string)
    Me.obj.Value = Null
 End Sub
 


thanks very much for any replies

Reply With Quote
  #2  
Old March 21st, 2005, 11:58 AM
pmcnamee pmcnamee is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Feb 2005
Posts: 13 pmcnamee User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 12 m 52 sec
Reputation Power: 0
try calling the sub procedure without the parentheses
Code:
FuncWOParam

you don't use parentheses unless your 'function' returns a value.

You are actually using 'sub procedures', not functions.

Reply With Quote
  #3  
Old March 21st, 2005, 04:00 PM
helz helz is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Mar 2005
Posts: 5 helz User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 24 m 30 sec
Reputation Power: 0
ok will call them that from now on.

any ideas on how i can use a parameter in a sub procedure directly in a command such as

me.parameterhere.value = null
(the sub procedure is one that clears the values of the form fields)

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsDatabasesMicrosoft Access Development > VBA: Custom function without parameter giving Expected = error


Developer Shed Advertisers and Affiliates


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.

© 2003-2014 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap