Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can't register my module 1

Status
Not open for further replies.

MikeDNova

Programmer
Joined
Jul 3, 2002
Messages
86
Location
US
hey guys, i entered all my code and named my module. i declared it a public function, and i can't figure out why when i try to run the function from a query it doesn't recognize it. i've even tried inserting the code for the function within the VB code underlying the report and it still doesn't recognize the function.

can anyone explain why i can't use this function from within a query for a report???? am i missing something?

thanks,
mike
 
hi,

Here is a small example:

module:
public function GetType(iType) as string
select case itype
case 0
GetType = "Test 1"
case 1
GetType = "Test 2"
case 2
GetType = "Test 3"
case 3
GetType = "Test 4"
case else
GetType = ""
end select
end function

Query:
the function name must be preceeded by an egal sign:
=GetType([myType])

hope it can help Mal'chik [bigglasses]
 
everything looks right, but its still not working. anybody have any suggestions troubleshooting this???

 
Post your function on here and you can probably get a more specific answer to your current problem.

Marrow
 
Try setting a variable to the value of your function, and then writing your query using the variable value as a parameter - if you need more help with the last part, check my FAQ in this forum.

Also (I've made this mistake a few time also ... :P), have you made sure that the function actually returns a value? 'Cuz that's the only difference between a subroutine and a function - a function gives you something back, subs won't.

HTH

Greg
 
someone else had give me the function and it was supposed to work. and it was a replace function. the one you had written in the Faq did the same thing that i needed so i just cut and pasted that one and guess what, it works no problem.

so thanks again!
mike
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top