Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Queries / March 2006

Tip: Looking for answers? Try searching our database.

Variable Question

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
open a adobe file from a command button - 30 Mar 2006 05:37 GMT
I'm using a form & VBA to get information from a query.  It works but now I
want to store the information in the fields of the query to some VBA
variables.  My thinking was that I have a field in the query named 'project'.
In the VBA code I dim a variable named 'projectname', in the code I said
projectname = [qryFindInfo]![project].  It does not work but am I on the
right path??

Thanks in advance
Tom Ellison - 30 Mar 2006 05:57 GMT
Dear Open:

I recommend transforming the query so it can update to cause the changes you
want to accomplish.  This is easily done in most cases, and performs well.

Be sure to make a copy of the database when experimenting with any query
that can damage your data.

Tom Ellison

> I'm using a form & VBA to get information from a query.  It works but now
> I
[quoted text clipped - 6 lines]
>
> Thanks in advance
John Spencer - 30 Mar 2006 13:32 GMT
With this limited description it is hard to say what you need to do.
Perhaps you only need to use the DLookup function.
Perhaps you need to use a recordset to hold the query result and then grab
the value you need from the recordset.

As far as I know, it is not possible to reference a query directly and get
the value of a field.  Part of the difficulty in doing that would be knowing
which record to use - the first, the last, the tenth if there are ten or
more records.

DLookup does that with tables and predefined queries by grabbing the FIRST
match it finds.  That doesn't mean it will scan the records in any specific
order - it could be by index, by data storage order, or other means.

If the above doesn't help you solve you problem, I suggest you post the code
you are currently using and the SQL text of your query.

> I'm using a form & VBA to get information from a query.  It works but now
> I
[quoted text clipped - 6 lines]
>
> Thanks in advance
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.