Dlookup Run-time Error 3464
Contents |
Custom Search UtterAccess Forums>Microsoft® Access>Access Modules Dlookup In Code Produces Error 3464 - Data Type Mismatch In runtime error 2471 dlookup Criteria Expression, Access 2007 Forum HomeSearchHelpUA Messages|--
Runtime Error 2471 Access Dlookup
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 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 - 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 bubbapostView Member Profile Nov 9 2012, 04:09 PM Post#1Posts: 8Joined: 8-February 10From: Pacific NWHello,I have been unsuccessful at figuring this out. Please help.THere is my code:CODEFunction GetScrubDesc(lScrubID As Long) As StringGetScrubDesc = DLookup("[ScrubDesc]", "[Scrubs]", "[Sc
expression If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. Results 1 to 3 of 3 Thread: run time error 3464, Data type mismatch in criteria expression Tweet Thread Tools Show Printable Version Subscribe to this Thread… Search Thread Advanced Search Display Linear Mode Switch to Hybrid Mode Switch to Threaded Mode 12-27-04,08:26 #1 mantaraya View Profile View Forum Posts Registered User Join Date Dec 2004 Posts 19 Unanswered: run time error 3464, Data type mismatch in http://www.utteraccess.com/forum/index.php?showtopic=1995898 criteria expression run time error 3464, Data type mismatch in criteria expression Hi who can me help me out with this problem? I get the above error if I run this Dlookup. The colum RelationID comes out of an oracle table and the data type is Number. Both nummer and sDataEntryUser are Variant nummer = Me.txtRelationID sDataEntryUser = DLookup("[Data_Entry_User]", "Relations", "[RelationID] =" & "'" & nummer & "'") The funny thing is (well not so funny), nummer returns http://www.dbforums.com/showthread.php?1081562-run-time-error-3464-Data-type-mismatch-in-criteria-expression a number. If I put this number instead of the nummer in the Dlookup it gives me the information needed. What might it be. Many thankx in advanced. Reply With Quote 12-27-04,10:31 #2 Peter.t View Profile View Forum Posts Registered User Join Date Nov 2004 Posts 64 nummer = Me!txtRelationID 'if nummer is text it would be like so xx = DLookup("[textfield1]", "table1", "[TextField2]='" & nummer & "'") 'if nummer is integer it would be like so 'xx = DLookup("[Field1]", "table1", "[Field2]=" & 5) Me![FieldOnForm] = xx cheers Peter.T if its not to much trouble ymay be you could lit me know if it works Reply With Quote 12-27-04,19:14 #3 Peter.t View Profile View Forum Posts Registered User Join Date Nov 2004 Posts 64 it was late last night when I typed in my previous post, I have made some alteration just to tidy up the code nummer = Me!txtRelationID 'for text values use this code xx = DLookup("[textfield1]", "table1", "[TextField2]='" & nummer & "'") 'for integer/number values use this code xx = DLookup("[textfield1]", "table1", "[RelationID]=" & nummer) Me![ sDataEntryUser] = xx Reply With Quote Quick Navigation Microsoft Access Top Site Areas Settings Private Messages Subscriptions Who's Online Search Forums Forums Home Forums Non-SQL Forums MongoDB Database Server Software Adabas DB2 Informix Microsoft SQL Server MySQL Oracle Pervasive.SQL PostgreSQL Sybase Other Data Access, Manipulation & Batch Languages ASP Crystal Reports Del
Join INTELLIGENT WORK FORUMSFOR COMPUTER PROFESSIONALS Log In Come Join Us! Are you aComputer / IT professional?Join Tek-Tips Forums! Talk With Other Members Be Notified Of ResponsesTo Your Posts Keyword Search One-Click Access To http://www.tek-tips.com/viewthread.cfm?qid=1698214 YourFavorite Forums Automated SignaturesOn Your Posts Best Of All, It's Free! Join Us! *Tek-Tips's https://bytes.com/topic/access/answers/962903-run-time-error-3464-type-mismatch-criteria-expression functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail. Posting Guidelines Promoting, selling, recruiting, coursework and thesis posting is forbidden.Tek-Tips Posting Policies Jobs Jobs from Indeed What: Where: jobs by Link To This Forum! Add Stickiness To Your Site By Linking To This Professionally Managed Technical Forum.Just copy and runtime error paste the BBCode HTML Markdown MediaWiki reStructuredText code below into your site. Microsoft: Access Forms Forum at Tek-Tips HomeForumsProgrammersDBMS PackagesMicrosoft: Access Forms Forum DlookUp Run Time Error 3464 thread702-1698214 Forum Search FAQs Links MVPs DlookUp Run Time Error 3464 DlookUp Run Time Error 3464 DraGo150 (IS/IT--Management) (OP) 14 Nov 12 11:19 Hello, trying to understand what I am doing wrong. I have a DLookup to search the runtime error 2471 table for duplicate records before update, but it keeps producing an error. Any help would be appreciated. Private Sub DOB_LostFocus() If (Not IsNull(DLookup("[LastName]", _ "tbl_Client", "[LastName] ='" _ & Me!LastName & "'"))) Then If (Not IsNull(DLookup("[FirstName]", _ "tbl_Client", "[FirstName] ='" _ & Me!FirstName & "'"))) Then If (Not IsNull(DLookup("[DOB]", _ "tbl_Client", "[DOB] ='" _ & Me!DOB & "'"))) Then Else MsgBox "Name has already been entered in the database." Cancel = True Me.Undo Dim strDocName As String strDocName = "rpt_ClientSearch" DoCmd.OpenReport strDocName, acViewReport End If End If End If End Sub RE: DlookUp Run Time Error 3464 PHV (MIS) 14 Nov 12 12:01 Replace this: "tbl_Client", "[DOB] ='" _ & Me!DOB & "'"))) Then with this: "tbl_Client", "[DOB] =#" _ & Format(Me!DOB, "yyyy-mm-dd") & "#"))) Then Hope This Helps, PH. FAQ219-2884: How Do I Get Great Answers To my Tek-Tips Questions? FAQ181-2886: How can I maximize my chances of getting an answer? RE: DlookUp Run Time Error 3464 DraGo150 (IS/IT--Management) (OP) 14 Nov 12 13:51 Thank you PHV That worked... :) Just for my understanding the ' is for text and the # is for numbers? RE: DlookUp Run Time Error 3464 PHV (MIS) 14 Nov 12 14:23 The # is for dates. Numb
Ask a Question Need help? Post your question and get tips & solutions from a community of 418,497 IT Pros & Developers. It's quick & easy. Run time error 3464 Type mismatch in criteria expression P: 10 daisyMay1 Hello, I am trying to fix a db that was written by someone else. I had to change a key field (GroupNo) in a table from Numeric to Text and am now coming up with data type mismatch. In this part of the code keyNow has been defined as Variant = 0. Error is thrown on the DLookup line. Expand|Select|Wrap|Line Numbers PublicFunctiondoQueryDefSQL(ByReffromWhereAsString,OptionalkeyNowAsVariant=0)AsBoolean ... IffromWhere<>"Clicked"Then'Opened IfNz(DCount("*","Accounts","Location='0'"),0)=2Then keyNow=DLookup("GroupNo","Accounts","GroupNo<>0") Else keyNow=getDefault("GroupNo") EndIf EndIf ... Much thanks! Shar Jul 2 '15 #1 Post Reply ✓ answered by Stewart Ross To rule out problems with your definition of keyNo simply change its definition from variant to string. You can check whether DLookup is working as expected using the Immediate window in the VBA editor to execute a print statement for the DLookup itself: ? DLookup("GroupNo", "Accounts", "GroupNo<>'0'") This should not give a type mismatch error. If it does, leave out the Where clause and see what happens: ? DLookup("GroupNo", "Accounts") Without the Where clause this should return the GroupNo from the first row of the Accounts table. A type mismatch normally arises when an argument of a specific type is not supplied in compatible form - e.g. the where clause structured for a numeric comparison when a text comparison is required, or a null value being supplied when a defined type such as a string or integer has been specified. Difficult to know what else to advise until you can test the suggestions above. -Stewart Share this Question 6 Replies Expert Mod 2.5K+ P: 2,543 Stewart Ross If you have redefined GroupNo as a text field then the Where clause of the DLookup has to be modified slightly. Just as in a SQL Where clause, text values must be enclosed in single quotes: Expand|Select|Wrap|Line Numbers keyNo=DLookup("GroupNo","Accounts","GroupNo<>'0'") As you mention that your