Ms Access Error 2452
Search Community Links Social Groups Pictures & Albums Members List Calendar Search Forums Show Threads Show Posts Tag Search Advanced Search Find All Thanked Posts Go to Page... Thread Tools Rate Thread Display Modes 09-11-2013, 02:43 PM #1 manusri Newly Registered User Join Date: Dec 2012 Posts: 29 Thanks: 11 Thanked 0 Times in 0 Posts Why Run time error 2452 for Select statement hi everyone, I have a Access 2010 database with multiple unbound form and subforms. One subform has a list box that lists all personal name and role. the personal information is stored on the same subform itself.image is attahced. I have been wondering and trying to fix the Run-Time Error 2452 : "The expression you entered has an invalid reference to the Parent property." This is the code for the Open statement of the form. Code: Private Sub Form_Open(Cancel As Integer) Me.author.Value = "" Me.AuthorRole.Value = "" Me.fix.Value = "" Me.ORole.Value = "" Me.Condition.Value = "" Me.othrcondition.Value = "" Me.email.Value = "" Me.phone.Value = "" Me.Fx.Value = "" Me.CmbTest.Value = "" Me.chkCurrent.Value = "" Me.txtAction.Value = "" Dim db As DAO.Database Dim rcount As DAO.Recordset Dim rs As DAO.Recordset Dim SQLCount As String Dim SQLStr As String Dim Records As String Dim Count As Integer Dim i As Integer 'Dim rsName As String 'Dim rsRole As String 'Dim rsOthRole As String SQLCount = "SELECT Count(*) FROM Contacts WHERE SiteID = " & Me.Parent!NewSiteID.Value Set db = CurrentDb Set rcount = db.OpenRecordset(SQLCount, dbOpenDynaset) rcount.MoveFirst Count = rcount.Fields(0).Value rcount.Close Set rcount = Nothing ' recordset SQLStr = "SELECT Contacts.ContactID, Contacts.Name, Contacts.Role, Contacts.Suff, Contacts.OthRole, Contacts.Speciality, Contacts.SpecialityOther, Contacts.Email, Contacts.Phone, Contacts.Fax, Contacts.Test, Contacts.IsCurrent" & _ " FROM Contacts WHERE Contacts.SiteID = " & Me.Parent!NewSiteID.Value Set rs = db.OpenRecordset(SQLStr, dbOpenDynaset) Me.LstAuthors.RowSourceType = "Value List" If Count = 0 Then Me.LstAuthors.RowSource = "" Else rs.MoveFirst Do Until rs.EOF For i = 0 To Count - 1 With Me.LstAuthors .RowSourceType = "Value List" .ColumnCount = 4 .AddItem rs![Con
Custom Search UtterAccess Forums>Microsoft® Access>Access Forms Run-time Error '2452':, Access 2003 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 Macros|-- Access Modules|-- Access http://www.access-programmers.co.uk/forums/showthread.php?t=253355 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 - http://www.utteraccess.com/forum/index.php?showtopic=2029712 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 ayenView Member Profile Jun 28 2015, 02:42 AM Post#1Posts: 892Joined: 9-May 13Hello UA,I am getting the below error message w
question and get tips & solutions from a community of 418,595 IT Pros & Developers. It's quick & easy. Referencing problem P: n/a cmd I have code in the OnExit event of a control on a subform. The https://bytes.com/topic/access/answers/515923-referencing-problem code works properly in this instance. If, however, I put the same code in the OnExit event of a control on a Tab Control of a main form, the code errors out at the 2nd line. The error number is 13 and the description is "Type mismatch". Both controls are memo fields. I suspect that "Screen.ActiveControl.Parent" is not referencing the form as intended. Thanks for any help, Mark '********************* Dim frm As Form Set frm = Screen.ActiveControl.Parent If ms access frm.Dirty = True Then frm.Dirty = False End If '(rest of the code) '********************* Jul 25 '06 #1 Post Reply Share this Question 21 Replies P: n/a Allen Browne The Parent of a control is not necessarily the form. It could be the tab control (your example), or another control (e.g. for an attached label), or an option group (for a button in the group), or another form (for a subform control), and so on. Perhaps you could use ms access error use Form.ActiveControl, or pass a reference to the control if you are calling a generic procedure. -- Allen Browne - Microsoft MVP. Perth, Western Australia. Tips for Access users - http://allenbrowne.com/tips.html Reply to group, rather than allenbrowne at mvps dot org.