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 sizbut on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Function used by SQL Not Working

Status
Not open for further replies.

ChickenHawk

Programmer
Jul 25, 2002
8
SE
Hello, I'm sure this will turn out to be basic but it's got me stumped. I've been playing with it all weekend. I've pared it down to the simplest example I can that fails so hopefully it'll be clear to you. I know what the example is doing is somewhat redundant ... it's just an example.

This consistently fails with (of all things!) a compile error with ambiguous name 'Read_Click'. and the [Comments] column of my result table is populated with #Error.

Anyway, this is long already. Any help would be appreciated! Thanks ... ChickenHawk

Table: [Status Control]
Status CHAR(30) 'contains text status codes
Actve Boolean 'is this status desired for this report

SQL:
SELECT [Status], TestFunc([Active],[Status]) as [Comments]
FROM [Status Control]

Function:
Public Function TestFunc(Active As Boolean, AType As String) As String
If Active = True Then
TestFunc = "** Active **"
Else
TestFunc = "** Not Active **" + AType
End If
End Function
 
OK, Never Mind.

I didn't get it but there REALLY WAS a duplicate sub named Read_Click.

I assumed this was a bogus error message because I did not code any sub by that name. The problem was in code that was generated for a Form that I created using the wizard and then modified in Design view.

I never touched the code for this form (although I made a lot of changes in Design view), so I can only assume this to be a bug in the code generator.

Anyway, Access must recompile the whole module when you add a function. I was missing this and focusing on what might be wrong with my function (and there wasn't anything wrong there!).

Cheers,
ChickenHawk
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top