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 / Modules / DAO / VBA / December 2005

Tip: Looking for answers? Try searching our database.

Insert with count records

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
uGek - 15 Dec 2005 15:24 GMT
I am trying to insert the results from a recordset into a table. I have my
sql statement and it appears to work fine when I run it on its own function
but it is not doing what I am telling it to do.  Can anyone see what I am
doing wrong? Thanks
this is my sql statement.
----------------------------------------------------------------------------------------------
strSqlDump = "INSERT INTO fldTempCountByRDO (fldCountOfRDO, fldRDO, fldName)
Select Count(tblPC01.fldRDO) AS CountOffldRDO, fldRDO, fldName FROM tblPC01
WHERE fldRepMonth = '" & strRptMonth & "' GROUP BY fldRDO, fldName ORDER BY
fldName"

CurrentDb.Execute strSqlDump

----------------------------------------------------------------------------------------------  
Tim Ferguson - 15 Dec 2005 18:16 GMT
> but it is not doing what I am telling it to do.  

So, what is it doing and what do you thing you told it to do?

INSERT INTO fldTempCountByRDO (
   fldCountOfRDO,
   fldRDO,
   fldName)
SELECT
   COUNT(tblPC01.fldRDO) AS CountOffldRDO,
   fldRDO,
   fldName
FROM tblPC01
WHERE fldRepMonth = '" & strRptMonth & "'
GROUP BY fldRDO, fldName
ORDER BY fldName

B Wishes

Tim F
 
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.