Access 2003 Runtime Error 91
Contents |
here for a quick overview of the site Help Center Detailed answers to any runtime error 91 access vba questions you might have Meta Discuss the workings and policies of runtime error 91 windows 7 this site About Us Learn more about Stack Overflow the company Business Learn more about hiring runtime error 91 fix developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is runtime error 91 object variable or with block variable a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Why do I get Run-time Error 91 in this MS Access code? up vote 1 down vote favorite So, I have a MS Access database application. In this application is a
Runtime Error 91 Object Variable Or With Block Variable Not Set Excel
main form, which contains a number of subforms. One form in particular has a drop down box that I populate with dates from a database query. When one of these dates is selected, I run a subroutine that is supposed to update a recordset on the subform with history information. Below is some edited code (just removed the large number of fields from the queries) Private Sub pickdate_AfterUpdate() ''''''''''''''''''''''''''''''''''''''''' ' Add review history by selected date ''''''''''''''''''''''''''''''''''''''''' Dim rs As Recordset Set rs = CurrentDb.OpenRecordset("SELECT model, entered_date FROM history WHERE entered_date=#" & Me.pickdate.value & "# ORDER BY model DESC", dbOpenDynaset, dbSeeChanges) If rs.BOF = False Then rs.MoveFirst While rs.EOF = False Forms!main!histories.Form.Recordset.AddNew Forms!main!histories.Form.Recordset![model] = rs![model] Forms!main!histories.Form.Recordset![entered_date] = rs![entered_date] Forms!main!histories.Form.Recordset.Update rs.MoveNext Wend End Sub I get the error on the Forms!main!histories.Form.Recordset.AddNew line. I have tried the following versions of that line: Forms!main!histories.Form.Recordset.AddNew main!histories.Form.Recordset.AddNew histories.Form.Recordset.AddNew Me.Form.Recordset.AddNew Me.Recordset.AddNew Me.AddNew Me.main!histories.Form.Recordset.AddNew Me!histories.Form.Recordset.Addnew Me!main!histories.Form.Recordset.AddNew I am literally at my wit's en
+ Ask a Question Need help? Post your question and get tips & solutions from a community
Access 2003 Runtime Download
of 418,417 IT Pros & Developers. It's quick & easy. Run-time error ms access 2003 runtime download free download 91 Object Variable or With block variable not set P: n/a Richard Hollenbeck I've marked the line in access 2003 runtime disable security warning this subroutine where I've been getting this error. It may be something stupid but I've been staring at this error trying to fix it for over an hour. I'm http://stackoverflow.com/questions/12205496/why-do-i-get-run-time-error-91-in-this-ms-access-code pretty sure the table and field names and controls are all named correctly, and the control referred to in the errant code is open, and it has data in it. Private Sub cmdAddIngredientToRecipe_Click() ' Get RecipeID for future action query Dim recipeID As Long Dim dbGetRecipeID As DAO.Database Dim rsGetRecipeID As DAO.Recordset Dim StrSQL As String Set dbGetRecipeID https://bytes.com/topic/access/answers/506689-run-time-error-91-object-variable-block-variable-not-set = CurrentDb() StrSQL = "SELECT tblRecipes.lngRecipeID FROM tblRecipes WHERE (((tblRecipes.lngRecipeID)= " & [Forms]![frmRecipes]![lngRecipeID] & "));" Set rsGetRecipeID = dbGetRecipeID.OpenRecordset(StrSQL, dbOpenDynaset) recipeID = rsGetRecipeID.Fields(0) Set rsGetRecipeID = Nothing Set dbGetRecipeID = Nothing ' This works fine to this point ' Get IngredientID for future action query Dim IngredientID As Long Dim dbGetIngredientID As DAO.Database Dim rsGetIngredientID As DAO.Recordset 'I'm filling variables to use in an append query down later in this subroutine. StrSQL = "SELECT tblIngredients.lngIngredientID FROM tblIngredients WHERE tblIngredients.IngredientName = '" & cboIngredientName & "'" 'IngredientName is a text field. ' The next line is flagged as a problem. I get a run-time error 91" Object Variable ' or with block variable not set. I'm predicting something is wrong with my SQL statament on the previous line. Set rsGetIngredientID = dbGetIngredientID.OpenRecordset(StrSQL, dbOpenDynaset) IngredientID = rsGetIngredientID.Fields(0) Set rsGetRecipeID = Nothing Set dbGetRecipeID = Nothing MsgBox IngredientID 'just to test my code this far. End Sub Jun 29 '06 #1 Post Reply Share this Question 3 Replies P: n/a John Mishefske Richard Hollenbeck wrote: I've mar
Custom Search UtterAccess Forums>Microsoft® Access>Access Errors + Error Handling Runtime Error 91: Object variable or with http://www.utteraccess.com/forum/runtime-error-91-object-t1943014.html block variable not set -- HELP! Forum HomeSearchHelpUA Messages|-- UtterAccess.com NewsAccess Knowledge Center|-- Access Code Archive|-- Access Knowledgebase / FAQ|-- Access TutorialsMicrosoft® Access|-- Local Access User Groups (AUGs)|-- Interface Design|-- Access Q and A|-- Access Tables + Relationships|-- Access Queries|-- Access Forms|-- Access Reports|-- Access runtime error Macros|-- Access Modules|-- Access Date + Time|-- Access Errors + Error Handling|-- Access Built-in Functions|-- Access Searching + Data Mining|-- Access Records|-- Access Security|-- Access Automation|-- Access Database Container|-- Tool bars, Menu bars + Ribbon|-- Access Services (Web Databases)|-- Access Data Access Pages (Deprecated)|-- Access Data Projects - runtime error 91 ADP|-- Access Runtime, Packaging & DeploymentAnd More...|-- Microsoft SQL Server|-- SQL Server Reporting Services|-- Microsoft SharePoint|-- Microsoft Internet Explorer|-- Visual Basic 6 and Earlier|-- Visual Basic 2003 and Later|-- ASP and VBScript|-- Web Development|-- PHP, Perl, MySQL and Postgres|-- Other Database Engines|-- BI Tools and Applications|-- JAVA and C#|-- GraphicsMicrosoft® Office|-- Microsoft Excel|-- Microsoft Excel FAQs|-- Microsoft Word|-- Microsoft Outlook|-- Microsoft PowerPoint|-- Microsoft FrontPage/Exp. Web|-- Other Microsoft ProductsPC|-- Network Issues|-- Q & A - Hardware|-- Q & A - Software|-- Q & A - Other PC|-- Virus + Security DiscussionUtterAccess Odds and Ends|-- General Chat|-- Q & A - UtterAccess.com Forums|-- Q & A - Access Wiki Options KStarostaView Member Profile Apr 17 2010, 08:57 AM Post#1Posts: 246Joined: 29-September 06From: Fredericksburg, VAGood morning! I am trying to use SQL to update a table. Simple, right? I am getting