473,403 Members | 2,071 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,403 software developers and data experts.

Problem of Parameters in INSERT Query

While running a query (in MS Access 2007), the code of which is
Expand|Select|Wrap|Line Numbers
  1. INSERT INTO tbl_Resource_Master ( Resource_Last_Name, Resource_First_Name, Resource_Middle_Name, Resource_Mobile_Number )
  2. VALUES ( '[Resource Last Name]', '[Resource First Name]', '[Resource Middle Name]', [Resource Mobile] );
, it's prompting for the number field only.

Can you please help me on this?
Mar 6 '10 #1

✓ answered by TheSmileyCoder

Expand|Select|Wrap|Line Numbers
  1. INSERT INTO tbl_Resource_Master ( Resource_Last_Name, Resource_First_Name, Resource_Middle_Name, Resource_Mobile_Number ) 
  2. VALUES ( '[Resource Last Name]', '[Resource First Name]', '[Resource Middle Name]', [Resource Mobile] );
I don't know what you think your trying to accomplish with your SQL statement, but I can tell you what it will do.
It will insert the STRING "[Resource Last Name]", not values from a field called [Resource Last Name] (same for the next 2 fields). The reason why its only asking for the number field, is because thats the only field you have not enclosed in single quotes.

If your trying to transfer values from one table to another, you will need to include a FROM statement in your SQL. Where is access supposed to take the values from?

2 4506
TheSmileyCoder
2,322 Expert Mod 2GB
Expand|Select|Wrap|Line Numbers
  1. INSERT INTO tbl_Resource_Master ( Resource_Last_Name, Resource_First_Name, Resource_Middle_Name, Resource_Mobile_Number ) 
  2. VALUES ( '[Resource Last Name]', '[Resource First Name]', '[Resource Middle Name]', [Resource Mobile] );
I don't know what you think your trying to accomplish with your SQL statement, but I can tell you what it will do.
It will insert the STRING "[Resource Last Name]", not values from a field called [Resource Last Name] (same for the next 2 fields). The reason why its only asking for the number field, is because thats the only field you have not enclosed in single quotes.

If your trying to transfer values from one table to another, you will need to include a FROM statement in your SQL. Where is access supposed to take the values from?
Mar 6 '10 #2
Well, your answer
The reason why its only asking for the number field, is because thats the only field you have not enclosed in single quotes.
provided me with the solution. :)

The code that worked were
Expand|Select|Wrap|Line Numbers
  1. INSERT INTO tbl_Resource_Master ( Resource_Last_Name, Resource_First_Name, Resource_Middle_Name, Resource_Mobile_Number )
  2. VALUES (['Resource Last Name'], ['Resource First Name'], ['Resource Middle Name'], [Resource Mobile]);
The single quotes should have been inside square braces, in stead of outside those.

And, what I tried to achieve was to insert three values into the table "tbl_Resource_Master", either running the query directly or executing it from the VBA code, both of which produced same result.

Thanks a lot.
Mar 6 '10 #3

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

Similar topics

13
by: Lee | last post by:
Hello All, First of all I would like to say thank you for all of the help I have received here. I have been teaching myself Access for about 4 years now and I've always been able to find a...
7
by: mp | last post by:
No value given for one or more required parameters. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information...
2
by: altergothen | last post by:
Hi there I am a newbie to ASP.Net - Please Help! I am trying to insert the values of my variables into a database. If I try the following it works perfectly: string insertQuery = "INSERT into...
1
by: Eustice Scrubb | last post by:
I'm trying to use the Insert.aspx Quickstart and I'm getting a NULL pointer exception. Any help? <code> <script language="VB" runat="server"> Dim myConnection As SqlConnection Sub...
6
by: Not4u | last post by:
Hello Config : SQL 2000 on WIN 2000 (IIS 5.0) In my ASP page for some queries i have this error : Microsoft OLE DB Provider for SQL Server error '80040e31' Timeout expired
29
by: wizofaus | last post by:
I previously posted about a problem where it seemed that changing the case of the word "BY" in a SELECT query was causing it to run much much faster. Now I've hit the same thing again, where...
8
by: Martin Z | last post by:
INSERT INTO dbo.Transmission (TransmissionDate, TransmissionDirection, Filename, TransmittedData) VALUES (@TransmissionDate,@TransmissionDirection,@Filename,@TransmittedData); SELECT @retVal =...
0
by: CJM | last post by:
I have a fairly simple ASP application talking to an Oracle 10g DB using a mixture of ADO (OraOLEDB) and OO4O - the query here concerns some ADO code. One part of the application records...
6
by: Mark | last post by:
Hi, i have an application which works with date. The regional settings of the computer (XP prof. dutch version) are set to French (Belgium). Asp.net and Sql server take the short date format of...
11
by: SAL | last post by:
Hello, I have a Gridview control (.net 2.0) that I'm having trouble getting the Update button to fire any kind of event or preforming the update. The datatable is based on a join so I don't know...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.