473,395 Members | 1,678 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Runtime error 2498 - Wrong data type

I have a navigation form with (3) subforms within (1) tab. The customer table in this particular instance is the parent to the customer contacts table. Customer form is a single form, contacts form is a continuous form. Customer table has the PK CompanyID, customer contacts table has the PK ContactID and the FK CustomerID.

In the footer of the customer contact form there is a button to enter a new contact and selecting it opens a separate form to input a new customer contact. When doing this I get the error "Runtime error 2498 Expression entered is the wrong data type for one of the arguments".

Below is the Click event to add a contact and the On Load event of the form it is supposed to load:
Expand|Select|Wrap|Line Numbers
  1. Private Sub btnAddContact_Click()
  2. DoCmd.OpenForm "frmAddCompanyContact", , , , acFormAdd, , Me!CompanyID
  3. End Sub
Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_Load()
  2.   If Not IsNull(Me.OpenArgs) And Me.NewRecord Then
  3.       Me!CompanyID = Me.OpenArgs
  4.   End If
  5. End Sub
Dec 13 '16 #1
2 3265
OpenArgs are strings - ie text values. If CompanyID is a numeric value (as I suspect), you need to convert it in your form_load event to the suitable format.
Dec 14 '16 #2
I neglected to check what the data type arguments are supposed to be when using openargs and didn't realize it required a text value. Since I'm using the PK (numeric), obviously this wouldn't work. I would rather not go through data conversions so on to a different method. I'm still green with Access and have to look up most methods. Have a better method you can recommend?
Dec 14 '16 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: japh | last post by:
I am on chapter 7 of my C++ text (sigh). Could you help me understand this? If the user inputs an int, the script works as it should. If they enter a char instead, it goes into an endless loop. ...
3
by: Jeff | last post by:
Hello I need help with a problem I have homework for a larger program than shown below but the code below effectively shows the problem whem compiled and executed. Basically, I want to be...
1
by: deko | last post by:
Okay, so I figured out how to pull Outlook Appointments into an Access Table (see below). But the data comes in the wrong Data Type - how do I convert it from Text to Long Integer? For...
1
by: ArcadeJr | last post by:
Good morning all! I have been getting a Run-time Error message #3464 - Data Type mismatch in criteria expression. While trying to run a query. I have a database where the field Asset_Number...
0
by: Scott Jasperse | last post by:
I have created a Web Service using visual studio that returns a custom stongly-typed collection that I created to contain a custom class. In order for the collection class to work, it must have a...
1
jamesd0142
by: jamesd0142 | last post by:
sql server 2000 declare @a varchar(20) Set @a = (select CONVERT(CHAR(10),GETDATE(),103)) update Users SET = DD3_Password, PasswordChanged = @a from temptable2 where Users.Login =...
10
by: gilsygirl | last post by:
Hi Guys Season greetings to everyone. Does anyone have an idea to this error message. Thanks gilsygirl
2
by: Mike | last post by:
I'm running DB2 v7 for z/OS. When I use SPUFI, SELECT CAST(6.0 AS FLOAT)/CAST(10.0 AS FLOAT) FROM SYSIBM.SYSDUMMY1 returns 0.6000000000000000E+00. When I use DSNTIAUL,DSNTEP2, or DSNALI (call...
1
by: will1 | last post by:
Hi, I have searched for several days to try to resolve my little problem.Sorry but I have very little experience with JavaScript OOP. I have a form which consists of at least one line. Each...
4
by: isitha | last post by:
String empID = cmbEmp.ValueMember.ToString(); int empIDint = Convert.ToInt16(empID); This`s the error i get "Input string was not in a correct format." "when converting a string to date time,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.