|
-
Dec 5th, 2000, 11:12 PM
#1
Thread Starter
New Member
I have an access query which looks something like this:
SELECT batting.player, careerteams(batting.player), stuff
FROM batting
WHERE batting.seg = 0
The careerteams is actually a function within access that returns back all the teams a player ever played for.
When I try to use the query in VB (regardless of where or how), it tells me its an invalid function call.
I've tried copying the function over to VB and having it be public in a module within my program, and still can't seem to get it to convert.
Is this possible with VB and I'm just missing something?
Thanks,
Chad
-
Dec 6th, 2000, 08:47 AM
#2
Lively Member
Hi
try something like this...
Code:
Dim MySQL as string
MySQL = "SELECT batting.player, " & careerteams(batting.player) & ", stuff FROM batting WHERE batting.seg = 0"
If you can solve the problem, why worrying about it…
If you can’t solve the problem, worrying won’t help…
De la Motte Günther
-
Dec 6th, 2000, 08:52 AM
#3
Fanatic Member
As far as I know, you cannot use User Defined Functions (UDFs) in this way in VB. The best way is to run a simple SELECT and then use the function on the resultant recordset.
e.g.
base a recordset, rs, say, on:
SELECT batting.player, "temp" As PlaceHolder, stuff FROM batting WHERE batting.seg = 0
With rs Do
Do Until .EOF
.Edit
!PlaceHolder = CareerTeams(!player)
.Update
.MoveNext
Loop
End With
Change for ADO and add error checking as necessary.
Cheers,
P.
Not nearly so tired now...
Haven't been around much so be gentle...
-
Dec 6th, 2000, 10:12 AM
#4
Thread Starter
New Member
Thanks
Shortly after my posting, I found in a book that I couldn't use the function in a VB query. Thanks for the workaround suggestion. That was going to be my next question.
Chad
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|