A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Running & Setting Up Queries
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Access DAO Query



 
 
Thread Tools Display Modes
  #1  
Old August 3rd, 2005, 09:39 PM
Bill Andersen
external usenet poster
 
Posts: n/a
Default Access DAO Query

In Access 2000 DAO, what is the syntax to refer to a field in an open query?
  #2  
Old August 3rd, 2005, 10:23 PM
[MVP] S.Clark
external usenet poster
 
Posts: n/a
Default

Trick question.

An opened query on screen is not a reference-able object, like say a form
is. Thus once it's opened, it's just there.

Explain what you're really trying to do, and we'll tell you how to do it.

--
Steve Clark, Access MVP
FMS, Inc.
Call us for all of your Access Development Needs!
1-888-220-6234

www.fmsinc.com/consulting

"Bill Andersen" Bill wrote in message
...
In Access 2000 DAO, what is the syntax to refer to a field in an open
query?



  #4  
Old August 3rd, 2005, 10:32 PM
Chaim
external usenet poster
 
Posts: n/a
Default

Any of the following will do:

dim rst as DAO.Recordset

set rst = CurrentDB.OpenRecordset ("name of a table or query")
debug.print "Value of a field in rst: " & rst.name of the field
OR
debug.print "Value of a field in rst: " & rst.Fields ("name of the field")
OR
debug.print "Value of a field in rst: " & rst.Fields(Ordinal referring to
the field, starting at 0)

Good Luck!
--
Chaim


"Bill Andersen" wrote:

In Access 2000 DAO, what is the syntax to refer to a field in an open query?

  #5  
Old August 3rd, 2005, 11:59 PM
Bill Andersen
external usenet poster
 
Posts: n/a
Default

Chaim showed me the way. I need to open the query as a recordset, then I can
refer to the field as "rst.fields("field name").

thanks for your attention.

Bill Andersen

"[MVP] S.Clark" wrote:

Trick question.

An opened query on screen is not a reference-able object, like say a form
is. Thus once it's opened, it's just there.

Explain what you're really trying to do, and we'll tell you how to do it.

--
Steve Clark, Access MVP
FMS, Inc.
Call us for all of your Access Development Needs!
1-888-220-6234

www.fmsinc.com/consulting

"Bill Andersen" Bill wrote in message
...
In Access 2000 DAO, what is the syntax to refer to a field in an open
query?




 




Thread Tools
Display Modes

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 Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Why can't I see my Access query through Word?? LisaLev General Discussion 1 September 26th, 2005 07:34 PM
What is the difference between 2002 and 2003? Red Sonya General Discussion 2 March 1st, 2005 05:10 AM
How to use a Access Query that as a parameter into Excel database query Karen Middleton Setting Up & Running Reports 1 December 13th, 2004 07:54 PM
Linking problem - Access query to MS query to extract data to Exce FatMan Running & Setting Up Queries 0 November 23rd, 2004 06:43 PM
Merging MS Word document with MS Access 2002 criteria query Doug Robbins Mailmerge 2 November 4th, 2004 05:57 PM


All times are GMT +1. The time now is 05:03 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.