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 / Forms / March 2007

Tip: Looking for answers? Try searching our database.

Using DAO

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Matt Pierringer - 21 Mar 2007 15:31 GMT
Alright I am using DAO to loop through a recordset(like my other
question, I still need help in my other question as well, but maybe I
can get a smaller answer here), but I am going to be way more specific
on what I need.

Set strSql = "SELECT tblProducts.Catalog, tblProducts.MaterialNumber,
tblProducts.Manufacturer, tblProducts.GMR, tblProducts.Category,
tblProducts.Description, tblProducts.[Sub-Category],
tblProducts.SortOrder, tblProducts.AddedNote, tblProducts.Required,
tblProducts.NoList, tblProducts.Hyper_Link, tblProducts.ProductID,
tblProducts.Deleted, tblProducts.Cost From tblProducts WHERE
(((tblProducts.Manufacturer) Is Not Null And
(tblProducts.Manufacturer) Like " & rsQuery!Manufacturers & ") AND
((tblProducts.Deleted)=False));"

My question is when I am using DAO how should I be referring to what I
need "rsQuery!Manufacturers" or should it be a string like strManuf
and how would I go about declaring that (as DAO.recordset?)

Thanks,
Matt
mscertified - 21 Mar 2007 15:50 GMT
Dim rs as new DAO.recordset

rs.fields("Fieldname").Value

don't foreget do do a
rs.close
set rs = nothing
at the end of your procedure

-Dorian

> Alright I am using DAO to loop through a recordset(like my other
> question, I still need help in my other question as well, but maybe I
[quoted text clipped - 17 lines]
> Thanks,
> Matt
mscertified - 21 Mar 2007 15:53 GMT
By the way your 'SELECT' statement is invalid. You need a FROM clause.

-Dorian

> Alright I am using DAO to loop through a recordset(like my other
> question, I still need help in my other question as well, but maybe I
[quoted text clipped - 17 lines]
> Thanks,
> Matt
John W. Vinson - 21 Mar 2007 19:51 GMT
>Alright I am using DAO to loop through a recordset(like my other
>question, I still need help in my other question as well, but maybe I
[quoted text clipped - 14 lines]
>need "rsQuery!Manufacturers" or should it be a string like strManuf
>and how would I go about declaring that (as DAO.recordset?)

You're not using DAO, not yet anyway. You've set up a text string and (in your
posted code) you've said nothing at all about recordsets. Where is rsQuery
defined? Do you have a previous OpenRecordset action?

I'd avoid using LIKE unless you explicitly want to use wildcards. The =
operator is more efficient. If Manufacturer is a Text field you'll also need
quotemark  - Chr(34) is " -delimiters:

tblProducts.Manufacturer = " & Chr(34) & rsQuery!Manufacturers & Chr(34) & ")

            John W. Vinson [MVP]
David W. Fenton - 22 Mar 2007 15:38 GMT
> Alright I am using DAO to loop through a recordset

What are you doing when looping through the recordset? If you're
updating a bunch of records to the same value or to some value that
can be calculated from the values in the same row, then a SQL UPDATE
query would likely be vastly faster.

Signature

David W. Fenton                  http://www.dfenton.com/
usenet at dfenton dot com    http://www.dfenton.com/DFA/

 
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.