Search results

  1. M

    emails from database via VBA script

    With many eyes all bugs are shallow! Linus' Law Cheers pbaldy that fixed all the script errors. The end product looks like it only got one result though and produced one email. How / where can i add this date between condition to the sql query Between #11/1/2012# And #11/30/2012# this...
  2. M

    emails from database via VBA script

    Yes that is an accurate description of the Sales table and I made the changes you suggested and it now runs past that part of the function. It now falls over at this point - with an object not found error 424 BodyStr = BodyStr & rst.Fields(0) & "|" & rs.Fields(1) & "|" & rs.Fields(2) &...
  3. M

    emails from database via VBA script

    Hello CJ I have added the code you highlighted in red and it still falls over with the same error message, below is the script thus far. Can you help me understand what this end of the SQL statement is suppose to do and perhaps I can help you to help me. I can see that it's selecting the...
  4. M

    emails from database via VBA script

    I also tried this advice from an earlier post of yours as a possible solution to the error WHERE memID= '" & memID & "'"
  5. M

    emails from database via VBA script

    Hello CJ I made all the changes you suggested and it's still stuck on this line. This includes a declaration of MemID as long at the top of the function. Set rs = db.OpenRecordset("SELECT ID,bfast,lunch,dwine,bar,desert,cellar,table,tdate FROM Sales WHERE MemID=" & MemID) Run- time error...
  6. M

    emails from database via VBA script

    Both tables have the standard ID field which all access tables have by design . I am not using any forms, just datasheet view as an input method.
  7. M

    emails from database via VBA script

    Both tables have the standard ID field which all . I am not using any forms, just datasheet view as an input method.
  8. M

    emails from database via VBA script

    Public Function emailbodfunc() Dim rs As Recordset Dim db As Database Dim email As String Dim BodyStr As String Set db = CurrentDb Set rs = db.OpenRecordset("SELECT ID,bfast,lunch,dwine,bar,desert,cellar,table,tdate From Sales WHERE ID=" & ID) BodyStr = "" While Not rs.EOF BodyStr = BodyStr &...
  9. M

    emails from database via VBA script

    Hello The two lines of the script which continue to throw up errors are Set rs = db.OpenRecordset("SELECT ID,bfast,lunch,dwine,bar,desert,cellar,table,tdate From Sales WHERE ID=" & ID) syntax error missing operator in query expression 'ID=' and Set rs = db.OpenRecordset("SELECT ID...
  10. M

    emails from database via VBA script

    yep, I'm all too aware abount the American date issue, i spent soooo long stuck on it.
  11. M

    emails from database via VBA script

    i also need to include a where condition in one of the queries so the statment will be for the month in the between date below, which query should this go into? The field is tdate and it is on the Sales table btw. WHERE tdate between #11/01/2012 00:00:000# and #11/30/2012 00:00:000#
  12. M

    emails from database via VBA script

    Set rs = db.OpenRecordset("SELECT ID, Firstname, Surname, emailaddress" & _ "FROM Members" & _ "ORDER BY ID;") error 91 'Object var with block var not set' on compile
  13. M

    emails from database via VBA script

    hmmmm 'ID' is just the autonumber standard field which all Access tables create. I have another field called memberID in members and its data type is 'number' . How does that effect the script?
  14. M

    emails from database via VBA script

    Now this line is flagging up a syntax error in query expression 'ID=' Set rs = db.OpenRecordset("SELECT ID,bfast,lunch,dwine,bar,desert,cellar,table,tdate From sales WHERE ID=" & ID)
  15. M

    emails from database via VBA script

    CJ I updated the script with your suggested additions and it seemed to run well till this line in the emailaddressfunc function which returns a syntax error. BodyStr = emailbodyfunc(rs.Fields("ID")
  16. M

    emails from database via VBA script

    I'm not having as much joy as JBR Taylor my script keeps on complaining about object or block variables. Public Function emailbodfunc() Dim rs As Recordset Dim db As Database Dim email As String Dim BodyStr As String Set rs = db.OpenRecordset("SELECT...
  17. M

    emails from database via VBA script

    Got it my script working with Outlook but as soon as it runs I get a message saying "A program is trying to send an email message on your behalf. Click deny and check your virus definitions are up to date" I click 'allow' instead of 'deny' and I get a run time 424 error saying object required...
  18. M

    emails from database via VBA script

    I don't get the buildbody 'call to a function line and am I to assume the the rst.fields elements in the docmd are meant to reference parts of the recordset created above it in which case what do you call fields once they are in a recordset?
  19. M

    emails from database via VBA script

    Cheers, but I have read that to and it makes very little sense to the uninitiated. It's just reams of code with little in the way of explanation. There aren't even any comments, just a sentence at the top saying what is roughly does.
Back
Top Bottom