Hi
I have been trying to run this code, and what it is doing is inserting records into a table called tblRequestByService. 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 [tblRequestByService]([Serviced Requested], [Service Provider], [Requested By], [Start Date], [Duration]) " & _
"VALUES (forms![frmSearchService].[txtForService], forms![frmSearchService].[txtServiceProvidedBy], forms![frmSearchService].[txtRequestBy], forms![frmSearchService].[txtRequiredDate], forms![frmSearchService].[txtDuration],1);"
DoCmd.RunSQL strSQL
End Sub
Please can anyone tell me how to solve this problem
3 1353
Your query has 5 fields and 6 values. Remove the ",1" from the end of the statement as follows: -
Dim strSQL As String
-
-
strSQL = "INSERT INTO [tblRequestByService] " & _
-
"([Serviced Requested], [Service Provider], [Requested By], [Start Date], [Duration]) " & _
-
"VALUES (forms![frmSearchService].[txtForService], forms![frmSearchService].[txtServiceProvidedBy], " & _
-
"forms![frmSearchService].[txtRequestBy], forms![frmSearchService].[txtRequiredDate], " & _
-
"forms![frmSearchService].[txtDuration]);"
-
DoCmd.RunSQL strSQL
-
-
End Sub
-
Mary
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
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 -
DoCmd.OpenForm "FormName", , , , acFormAdd
Sign in to post your reply or Sign up for a free account.
Similar topics
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...
|
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: ...
|
by: iKiLL |
last post by:
Hi All
Code Below for this problem
ERROR: "An existing connection was forcibly closed by the remote host"
|
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...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
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...
|
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...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
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...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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...
| |