<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD><TITLE>Message</TITLE>
<META http-equiv=Content-Type content="text/html; charset=us-ascii">
<META content="MSHTML 6.00.2800.1170" name=GENERATOR></HEAD>
<BODY>
<DIV><SPAN class=238315216-01072003><FONT face=Arial color=#0000ff size=2>Yes,
but were you running the code inside the database with the function? I am
talking about a wizard where the code is external to the query db. It
opens the database, sets a querydef and looks at the field collection.
>From OUTSIDE the db that has the query and function it is not working here (in
A2K).</FONT></SPAN></DIV>
<DIV><SPAN class=238315216-01072003><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=238315216-01072003><FONT face=Arial color=#0000ff
size=2>Function QryFldLst(strDBName As String, strQryName As String) As
String<BR>On Error GoTo Err_QryFldLst<BR>Dim wks As DAO.Workspace<BR>Dim dbs As
DAO.Database<BR>Dim fld As DAO.Field<BR>Dim str As String<BR>Dim qdf As
DAO.QueryDef<BR> Set wks = DBEngine(0)<BR>
Set dbs = wks.OpenDatabase(strDBName)<BR> Set qdf =
dbs.QueryDefs(strQryName)<BR> For Each fld In
qdf.Fields<BR> If Len(str) > 0
Then<BR> str =
str & ";"<BR> End
If<BR> str = str &
fld.Name<BR> Next<BR> If Len(str) = 0
Then<BR> MsgBox strQryName & " NOT
FOUND in " & "QryFldLst"<BR>
Else<BR> QryFldLst =
str<BR> End If<BR> <BR>Exit_QryFldLst:<BR>On
Error Resume Next<BR> Set fld = Nothing<BR>
If Not (dbs Is Nothing) Then dbs.Close: Set dbs = Nothing<BR>
If Not (wks Is Nothing) Then wks.Close: Set wks = Nothing<BR>Exit
Function<BR>Err_QryFldLst:<BR> Select Case
Err<BR> Case 0 '.insert Errors
you wish to ignore here<BR> Resume
Next<BR> Case Else '.All other errors will
trap<BR>
Beep<BR> MsgBox Err.Description, ,
"Error in Function Module1.QryFldLst"</FONT></SPAN></DIV>
<DIV> </DIV>
<DIV><SPAN class=238315216-01072003><FONT face=Arial color=#0000ff
size=2> Resume
Exit_QryFldLst<BR> End Select<BR> Resume
0 '.FOR TROUBLESHOOTING<BR>End
Function<BR></FONT></SPAN></DIV>
<P><FONT size=2>John W. Colby<BR>www.colbyconsulting.com</FONT> </P>
<BLOCKQUOTE dir=ltr style="MARGIN-RIGHT: 0px">
<DIV class=OutlookMessageHeader dir=ltr align=left><FONT face=Tahoma
size=2>-----Original Message-----<BR><B>From:</B>
accessd-bounces@databaseadvisors.com
[mailto:accessd-bounces@databaseadvisors.com]<B>On Behalf Of </B>Mark
H<BR><B>Sent:</B> Tuesday, July 01, 2003 12:38 PM<BR><B>To:</B> 'Access
Developers discussion and problem solving'<BR><B>Subject:</B> RE: [AccessD]
weird query def <BR><BR></FONT></DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN
class=187103516-01072003>John</SPAN></FONT></DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN
class=187103516-01072003></SPAN></FONT> </DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN class=187103516-01072003>I
just tried it using Access XP and a recordset and it
worked.</SPAN></FONT></DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN
class=187103516-01072003></SPAN></FONT> </DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN class=187103516-01072003>I
created a query with a column called "X" which was the result of a function
which multiplies table columns a and c. I then created an adodb.recordset,
cycled through the fields and managed to debug.print each fields name. "X" was
there...</SPAN></FONT></DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN
class=187103516-01072003></SPAN></FONT> </DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN
class=187103516-01072003>hth</SPAN></FONT></DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN
class=187103516-01072003></SPAN></FONT> </DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN
class=187103516-01072003>Mark</SPAN></FONT></DIV>
<BLOCKQUOTE dir=ltr style="MARGIN-RIGHT: 0px">
<DIV></DIV>
<DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left><FONT
face=Arial color=#0000ff
size=2></FONT> </DIV></BLOCKQUOTE></BLOCKQUOTE></BODY></HTML>