Search results

  1. D

    Email generation & tracking system - loops querydefs recordsets...

    Currently I am looking at using a field added to a query to mark (with a minus 1) the previous weeks completed work requests Prev Week Completed: Year([ModDate])*53+DatePart("ww",[ModDate])=Year(Date())*53+DatePart("ww",Date())-1 Then I am looking at working this in somewhere to loop round...
  2. D

    Email generation & tracking system - loops querydefs recordsets...

    Good afternoon, I have a previous post linking to this one but the way i am now doing it is different (Hence this new post) My aim is to import data, use a query to pull back the previous weeks data. Generate an email with this data. Then, the next week, import that data and send that...
  3. D

    Opening an ADODB.Recordset with an SQL statement,taking into account a date on a form

    qryCompleteWorkRequests has a field called Modified which is a date when the work request was complete. The user specifies a date range to email all the people who raised the work requested completed in say a week... It works for the 1st record...but not the remaining. I have a feeling that it...
  4. D

    Opening an ADODB.Recordset with an SQL statement,taking into account a date on a form

    OK I reconnected to copy of the linked table but where i could put different dates in... I only produces one email. The loop cannot be working correctly. I do not get any error messages, any ideas?
  5. D

    Opening an ADODB.Recordset with an SQL statement,taking into account a date on a form

    I feel like I have been constantly coding through the night! The two pieces of code I have work to some extent. The following code takes the work request puts it into a table and then calls a module to generate the email. It then time and date stamps it. Sent marker and user etc. The bit i...
  6. D

    Opening an ADODB.Recordset with an SQL statement,taking into account a date on a form

    This is great! I found a site which explained this just before your post and I am working on QueryDefs and trying to open up the email now. Thanks again for your invaluable help
  7. D

    Opening an ADODB.Recordset with an SQL statement,taking into account a date on a form

    OK, I found a DAO Example and put it in a seperate module and ran that based on my query. I got an error saying "Too few parameters. Expecting 2" rather than one now. Instread of writing the SQL I reference the query itself Set MailList = db.OpenRecordset("qryCompletedWorkRequests") This...
  8. D

    Opening an ADODB.Recordset with an SQL statement,taking into account a date on a form

    It shows the SQL with the date I entered. So it seems to work. When I copy the SQL into the Query design grid in SQL view and then change it to design view and then I run it, it also works... very confusing! The query i refer to has a parameter of complete already specified and then I want the...
  9. D

    Opening an ADODB.Recordset with an SQL statement,taking into account a date on a form

    Here is some background. . . Main functionality - Generating an email from query results. Updating query results and sending the new emails out excluding the ones already sent I have 2 Tables Work_Requests, tblWorkRequests, 1 Queries...
  10. D

    Opening an ADODB.Recordset with an SQL statement,taking into account a date on a form

    This is what i have so far: Public Sub ControlOutlook2() Dim objOutlook As New Outlook.Application Dim objEmail As Outlook.MailItem Dim strLtrContent As String Dim strEMailMsg As String Dim rsContacts As DAO.Recordset Dim strSql As String Dim ctlEmailBox As String...
  11. D

    Opening an ADODB.Recordset with an SQL statement,taking into account a date on a form

    I haven't finished the start of the code. I got confused with switching from ADO to DAO and back so now trying to transflate one in the other but every example i have does it in a slighly different way? Do you have any sample code?
  12. D

    Opening an ADODB.Recordset with an SQL statement,taking into account a date on a form

    I can not get round the too few parameters. expected 1. It can't be getting the date from the form...? The field on the form frmCompletedWorkRequestsFROMteamsite is called Modified (the text control) with a control source of ModDate. I am trying to say where the...
  13. D

    Opening an ADODB.Recordset with an SQL statement,taking into account a date on a form

    I have been changing and looking at code so long I didn't even see that. I will change and work through the errors. Thanks for your help
  14. D

    Opening an ADODB.Recordset with an SQL statement,taking into account a date on a form

    Public Sub ControlOutlook2() Dim rst As DAO.Recordset strSQL = "" strSQL = strSQL & " SELECT qryCompletedWorkRequests.* " strSQL = strSQL & " FROM qryCompletedWorkRequests " strSQL = strSQL & " WHERE qryCompletedWorkRequests.ModDate=#" &...
  15. D

    Opening an ADODB.Recordset with an SQL statement,taking into account a date on a form

    Thanks! I didn't even realise it was not turned on :) You dont need the the Option Explicit at the top of a module window though do you? This is where my code is. I call it from the code behind the main form "frmCompletedWorkRequestsFROMteamsite" If i run the code in my module then i get...
  16. D

    Opening an ADODB.Recordset with an SQL statement,taking into account a date on a form

    I gave DAO a go also. I also prefer DAO but I just couldn't get it to work and ADO did (when just a table was involved) Pot luck! Error message when using DAO is: "The Microsoft Jet database engine cannot find the input table or query ". Make sure it exists and the name is spelt correctly"...
  17. D

    Opening an ADODB.Recordset with an SQL statement,taking into account a date on a form

    I kept the form open so it was accessible by the code and now I get the following message > "Invalid SQL statement expected; ‘DELETE’,’INSERT’,'UPDATE' or SELECT".
  18. D

    Opening an ADODB.Recordset with an SQL statement,taking into account a date on a form

    Thank you namliam. Your code makes much more sense and it a lot easier to read. I will take into account the #'s and Substitution an I should have known better about the reserved word. I will get that changed! I have implemented your code and it is saying that it cannot find the form i am...
  19. D

    Opening an ADODB.Recordset with an SQL statement,taking into account a date on a form

    Good afternoon everyone :o, I hope you can help? I am trying to generate emails based on a date on a form. I have created a VBA module, connected to a recordset, generated emails to be sent depending on that recordset with a table successfully. I want to change this so it only sends for...
  20. D

    Update a table based on query results via VBA

    Perhaps I should learn to read. After entering 'select *' and renaming fields, it kind of works. I know it kind of works as it is running until the update line of code. I then get an error message regarding duplicate values. So my new challange is to amend the code to only enter records that are...
Top Bottom