Ms Access Error 2498
Custom Search UtterAccess Forums>Microsoft® Access>Access Errors + Error Handling Error 2498: An expression you entered is the wrong data type for 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 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
Posts 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 05-12-2014, 06:42 PM #1 atrium Newly Registered User Join Date: May 2014 Posts: 163 Thanks: 9 Thanked 10 Times in 10 Posts Run-time error '2498' when adding a new record from a subform I have a main form with several subforms in tabs. From one of the subforms I list linked records to the main form (Clients) within that subform (Bank account details). I list the records and have a button to add new records. Where the Client has one or http://www.utteraccess.com/forum/index.php?showtopic=1349713 more records in the subform the add button works perfectly. When the subform has no records the add new records button produces the following error "Run-time error '2498' An expression you entered is the wrong data type for one of the arguments" The add button has Private Sub Command52_Click() DoCmd.OpenForm "AddClientBankDetailsFrm", acNormal, , , , acFormAdd, OpenArgs:=Me!ClientId End Sub the "AddClientBankDetailsFrm" popup form has Private Sub Form_Load() If IsNull(Me.OpenArgs) = False Then MsgBox "Form was opened with ClientID = http://www.access-programmers.co.uk/forums/showthread.php?t=264477 " & Me.OpenArgs Me!ClientId = Me.OpenArgs Else MsgBox "No ClientID was passed." End If End Sub ClientId is the primary key of the main form and the secondary key in the new record Any help would be appreciated Atrium atrium View Public Profile Find More Posts by atrium 05-12-2014, 08:57 PM #2 MarkK Super Moderator Join Date: Mar 2004 Location: Vancouver BC Posts: 6,377 Thanks: 4 Thanked 933 Times in 893 Posts What line causes the error? Or, if you have a main form with subforms, and you open that main form in Data Entry (acFormAdd) mode, then the Primary Key of the parent record will be null, and the sub forms will fail to link. This error might be that failure. One thing you can do then is add the record first, then open the form in edit mode, and go to that record. Probably the easiest way to do that is open a recordset, like . . . Code: dim newID as long with currentdb.openrecordset("yourTable") .addnew !foreignKey = Me.ClientID newID = !PrimaryKey .update .close end with DoCmd.OpenForm "SomeForm", wherecondition:="ClientID = " & newID So do you see what happens there? The new record is added and you keep a copy of the newID, then open the form in Edit Mode, and find that new record. Or you can load the subforms programmatically, and don't load them if the
Forum Visual Basic Programming Visual Basic 6.0 Programming [RESOLVED] Run-time Error 2498 If this is your first visit, be sure to check out the FAQ by clicking the http://forums.codeguru.com/showthread.php?527767-RESOLVED-Run-time-Error-2498 link above. You may have to register or Login 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 http://www.ozgrid.com/forum/showthread.php?t=145518 below. Results 1 to 7 of 7 Thread: [RESOLVED] Run-time Error 2498 Tweet Thread Tools Show Printable Version Email this Page… Subscribe to this Thread… Display Linear Mode Switch to Hybrid Mode Switch to ms access Threaded Mode September 21st, 2012,02:33 PM #1 Chad Jackson View Profile View Forum Posts Junior Member Join Date Aug 2012 Location Lubbock, TX Posts 15 [RESOLVED] Run-time Error 2498 I am working on some code that will send an e-mail through Outlook 2003 "On Click" of a button inside of a form in my 2003 Access db. The code was in a different database, and was working just ms access error fine, but now that I have moved it into the new db, I am having problems. I have checked and changed form names several times, so I am sure that the error has nothing to do with that. It is throwing the flag on the line that actually sends the e-mail. The e-mail sends just fine, and even includes the form I want as an attachment, but keep getting an error message titled "Run-time Error 2498" once VB runs through the code. As far as functionality goes, there is no problem, but this is certainly annoying, and would like for it to stop. Any help is greatly appreciated. Code: Option Compare Database ' Chad Jackson ' 9/21/2012 ' 5-Day E-Mail Notification ' This program finds all tickets that have been out for 5 days or longer, ' and then sends an e-mail to a pre-defined list of people. ' The purpose of this program is to help ensure a 5-day ticket turnaround time. ' Private Sub btnSendEmail_Click() Dim rs As DAO.Recordset Dim stDocName As String Dim StrAttach As String Set rs = CurrentDb.OpenRecordset("5-Day E-Mail Addresses") With rs If .EOF And .BOF Then ' If there are no records, the message from the next
Way | Trading Add-ins For Excel | Convert Excel Into Calculating Web Pages Excel Web Pages | Produce Clean Efficient VBA Code Every Time | Build Automated Trading Models In Excel | Excel Web Pages | Excel Video Training Forum New Posts FAQ Calendar Forum Actions Mark Forums Read Quick Links Today's Posts What's New? Advanced Search Forum OTHER SOFTWARE APPLICATIONS Excel and/or Access Help Importing a csv into access - error 2498 Excel Training / Excel Dashboards Reports 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. If you don't like Google AdSense in the posts, register or log in above. Click here to view the relaunched Ozgrid newsletter. New Features! We have added a new feature to the site - please visit the link below to read more about this OzGrid Features Update - 16th Oct 2016 Results 1 to 2 of 2 Thread: Importing a csv into access - error 2498 Thread Tools Show Printable Version Search Thread Advanced Search August 20th, 2010 #1 reswob View Profile View Forum Posts I agreed to these rules Join Date 11th August 2010 Posts 11 Importing a csv into access - error 2498 Hi, I've been trying to import a csv file from excel into access using the DoCmd.TransferText acImportDelim method. I've looked at the following posts: http://www.ozgrid.com/forum/showthre...t=71318&page=1 http://www.ozgrid.com/forum/showthre...t=32942&page=1 However, when I've run my macro I get a "run-time error 2498 An expression you entered is the wrong data type for one of the arguments" on the DoCmd.TransferText line. snippets of my macro are below (I took out all the error checking and input validation lines). VB: system = InputBox("What is the name of the system that was scanned?") Date1 = InputBox("Enter Date of the " & system & " Scan", , Format(Date, "dd-mmm-yyyy")) TableName = system & "_Scan_" & Date1 ' the above comes out to something like server1_Scan_20Aug-2010 Response = MsgBox("Would you like to open a report?", vbYesNoCancel) ' if the user clicks yes FileName = Application.GetOpenFilename("CSV Files (*.csv), *.csv", MultiSelect:=False) DoCmd.TransferText acImportDelim, , TableName, FileName, True, , "" where "TableName" is a variable loaded with the name of the table (created dynamically from user input) and "FileName" is a variable loaded with the full path to the file (also created dyn