Recent content by mor

  1. M

    Export querydef from Access to VBA to Word

    Hi Everyone! I have a rather complicated query which in essence takes a pass through query, writes the query to a VBA matrix, manipulates the data and then exports it to word as an invoice. Now here's my problem. Currently I have created a word document with built in bookmarks that allow the...
  2. M

    Export to Word from Access

    Thanks so much! Now I seem to get every other run through of the code runtime error 462, which I know is when the objects from word aren't properly referenced if running from another instance of VBA (Access in this case). However I though I had properly referenced everything here! Thanks for...
  3. M

    Export to Word from Access

    Hello Everyone, I'm trying to create an export to word but am having some trouble. I keep getting the following error; Run time error '91'; variable or object of With block not defined. This error occurs at Set TblWord = docNew.Tables.Add(Selection.Range, 3, 5) I have a feeling its...
  4. M

    Searching date before and using this in WHERE condition

    Hi everyone, I have a table that has 4 fields; id_vl, id_product, date_vl, vl. Basically each product is valued either on a monthly, weekly or daily basis. I want to create a filter that is based on a text box that filters the dates from which one can look at the dates of valuation and the...
  5. M

    Pass through query results to matrix which is then exported to excel

    Thanks namliam! Final question I promise : ) Why do you call wkbexcel and not wksexcel when using the With block? I thought if you would want to select a range you would have to specify the worksheet!
  6. M

    Pass through query results to matrix which is then exported to excel

    Ok I forgot to Set the wksExcel. Thanks everyone!
  7. M

    Pass through query results to matrix which is then exported to excel

    Thanks so much for your help.. But I now seem to be getting run time error '91'. Object variable or With block variable not set. This occurs at line WksExcel = WkbExcel.Sheets(1) Can anyone help out as to why this error occurs and why it needs a With block? Sub MiseEnForme1_Excel()...
  8. M

    Pass through query results to matrix which is then exported to excel

    With this code I get error 438, this property or method is not managed by this object. Code debugger references Wkb.Range("A1").Select. Code below Option Compare Database Sub MiseEnForme1_Excel() Dim AppExcel As Excel.Application Dim WkbExcel As Excel.Workbook Dim WksExcel As...
  9. M

    Pass through query results to matrix which is then exported to excel

    Namliam, that works great and is unbelievably helpful! May I ask for some further help though? I have made the above modifications and now have the following issues: The code now works alternately. Every other time that I execute the code, the run time error 1004 appears. "The method "Sheets"...
  10. M

    Pass through query results to matrix which is then exported to excel

    hi JHB, I've added the DoEvents as seen below, but I still have the opening/closing problem of the excel window without any error and no seeming pattern as to when the code run correctly or not. Any ideas? [\CODE] Dim AppExcel As Excel.Application Dim WkbExcel As Excel.Workbook Dim WksExcel...
  11. M

    Pass through query results to matrix which is then exported to excel

    Hi all, I have wrote some code which calls a query using querydefs and then pulls all the records into a table. This table is then exported to excel, however I seem to be having some trouble with the export and am finding it difficult to identify where the problem is coming from. When I run my...
  12. M

    Query will only return maximum of one result

    Hello everyone, Does anyone know why this SQL will return only one query maximum? DateLimiter: (SELECT Date_Retro_Fees_Rate FROM tblRetroFees AS Alias WHERE Date_Retro_Fees_Rate = (SELECT FIRST(Date_Retro_Fees_Rate) FROM tblRetroFees AS Alias2 WHERE Alias2.Date_Retro_Fees_Rate >...
  13. M

    Trouble with filtering records

    Hello everyone, I have a bit of a problem running a query that may either need some SQL code or may be completed in Design mode. I have 6 fields: Deal_id, Product, Date_VL, VL, Date_Retro_Fees, Retro_Fees. Basically each deal has an associated product. The price of this product changes either...
  14. M

    Passing parameters in a QueryDef by using prgram code

    Thanks Peter :) Just the answer I wanted!!!
Top Bottom