VBA reading a field form a query in Access 
Author Message
 VBA reading a field form a query in Access

Does anyone know how to read a field from a query in Access for use in a VBA
function?

Function YearToDateValue()
    Dim ytdv
    DoCmd.OpenQuery ("ytd")
    ytdv = [ytd]![Value of Cash Sales Since Init]
    MsgBox ytdv
End Function

When I do this I get "External name not defined". I can reference fields in
forms just fine within VBA code, but I can't for queries or tables. Does
anyone know what I'm doing wrong? Also, is there a specific newsgroup for
VBA?

Thanks,
Michael



Sun, 15 Dec 2002 03:00:00 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. Access VBA code for query field

2. How to access mail message fields from a VBA form which was executed by that message

3. How to access mail message fields from a VBA form which was executed by that message

4. Need help reading Outlook keyword fields into Access field

5. Starting query from a form (criterium being based on a text field in the form)

6. Accessing a Subform field from a Query in Access

7. VBA - Access 2000 Create a table and access the fields

8. parameter query in VBA when parameter not a field

9. Format Date field in query using VBA

10. Pb Query Number field on Oracle db w/ Vba Excel

11. Querying Field Descriptions in Access Database

12. Querying part of a field in Access using ASP

 

 
Powered by phpBB® Forum Software