473,809 Members | 2,739 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

sql error message

29 New Member
Hi
I have been trying to run this code, and what it is doing is inserting records into a table called tblRequestBySer vice. the values that it is inserting are taken from the form itslef (They are normal text boxes). every time i click the button to do that, i get the folling error message:

"Number Of Query Values and Destination Fields are not the same". I have been having similar problems throughout. i know that the number of fields that i am inserting is the same number of fields on the actual table.

This is the code that i hjave been using.

Dim strSQL As String

strSQL = "INSERT INTO [tblRequestBySer vice]([Serviced Requested], [Service Provider], [Requested By], [Start Date], [Duration]) " & _
"VALUES (forms![frmSearchServic e].[txtForService], forms![frmSearchServic e].[txtServiceProvi dedBy], forms![frmSearchServic e].[txtRequestBy], forms![frmSearchServic e].[txtRequiredDate], forms![frmSearchServic e].[txtDuration],1);"
DoCmd.RunSQL strSQL

End Sub



Please can anyone tell me how to solve this problem
Apr 18 '07 #1
3 1365
MMcCarthy
14,534 Recognized Expert Moderator MVP
Your query has 5 fields and 6 values. Remove the ",1" from the end of the statement as follows:
Expand|Select|Wrap|Line Numbers
  1. Dim strSQL As String
  2.  
  3. strSQL = "INSERT INTO [tblRequestByService] " & _
  4.    "([Serviced Requested], [Service Provider], [Requested By], [Start Date], [Duration]) " & _
  5.    "VALUES (forms![frmSearchService].[txtForService], forms![frmSearchService].[txtServiceProvidedBy], " & _
  6.    "forms![frmSearchService].[txtRequestBy], forms![frmSearchService].[txtRequiredDate], " & _
  7.    "forms![frmSearchService].[txtDuration]);"
  8. DoCmd.RunSQL strSQL
  9.  
  10. End Sub
  11.  
Mary
Apr 18 '07 #2
Shokoth
29 New Member
thanks.

I am also trying to open up a from in add mode, from another form.
i have one form, and wen u click a button, it should take you to another form (from a different base table), and open that up in add mode.
I have tried a few several ways, but it doesn't work.
How is the solved
Apr 18 '07 #3
MMcCarthy
14,534 Recognized Expert Moderator MVP
thanks.

I am also trying to open up a from in add mode, from another form.
i have one form, and wen u click a button, it should take you to another form (from a different base table), and open that up in add mode.
I have tried a few several ways, but it doesn't work.
How is the solved
This will open a form in Add mode
Expand|Select|Wrap|Line Numbers
  1. DoCmd.OpenForm "FormName", , , , acFormAdd
Apr 18 '07 #4

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

Similar topics

8
10021
by: Rod | last post by:
I have been working with ASP.NET 1.1 for quite a while now. For some reason, opening some ASP.NET applications we wrote is producing the following error message: "The Web server reported the following error when attempting to create or open the Web project located at the following URL: 'http://localhost/WebApplication1'. 'HTTP/1.1 500 Internal Server Error'."
2
5338
by: f rom | last post by:
----- Forwarded Message ---- From: Josiah Carlson <jcarlson@uci.edu> To: f rom <etaoinbe@yahoo.com>; wxpython-users@lists.wxwidgets.org Sent: Monday, December 4, 2006 10:03:28 PM Subject: Re: 1>make_buildinfo.obj : error LNK2019: unresolved external symbol __imp__RegQueryValueExA@24 referenced in function _make_buildinfo2 Ask on python-list@python.org . - Josiah
0
3548
by: iKiLL | last post by:
Hi All Code Below for this problem ERROR: "An existing connection was forcibly closed by the remote host"
2
19501
hyperpau
by: hyperpau | last post by:
Before anything else, I am not a very technical expert when it comes to VBA coding. I learned most of what I know by the excellent Access/VBA forum from bytes.com (formerly thescripts.com). Ergo, I will be writing this article intended for those who are in the same level, or maybe lower, of my technical knowledge. I would be using layman's words, or maybe, my own words as how I understand them, hoping, you will understand it the same way that...
0
9722
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9603
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
10391
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10121
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9200
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6881
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5550
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
3862
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3015
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.