Search results

  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!!!
  15. M

    Passing parameters in a QueryDef by using prgram code

    Agreed but generally speaking you need to set warnings off and turn them back on again. Is there not a solution to using the querydefs method?
  16. M

    Passing parameters in a QueryDef by using prgram code

    If I run the query from a button with an on click event with the code above without parameters, I get the Error 3061, too few parameters: 2 expected. Dim Db As DAO.Database Set Db = CurrentDb Dim QDef As DAO.QueryDef Dim rst As DAO.Recordset Set QDef =...
  17. M

    Passing parameters in a QueryDef by using prgram code

    "The Field names form the left hand side of the Condition to be tested.. In other words Date_VL is the field name not the parameter name". Correct, Date_VL is the field name I want to apply parameters to. These parameters are defined in the query. I'm not sure I explained myself very well. I...
  18. M

    Passing parameters in a QueryDef by using prgram code

    Hi everyone, A bit stuck on how to execute some code. I have a query that searches for records that are between two dates using the WHERE clause. The two dates are referenced to two respective text boxes on a form. On the same form I have a button that will launch the query in VBA using...
  19. M

    Query not responding

    Hi everyone, I have some SQL code that is giving me some bother. I am creating a qeury whereby I have four fields in a table (id_vl,id_product,date_vl,vl). Basically each weekday I add a new value to VL (the value of a stock lets say) for each stock product that we are interested in. I want to...
Back
Top Bottom