473,396 Members | 1,785 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,396 software developers and data experts.

Syntax

i'm trying to insert integer, string, date data types into a table, code is as below

Error: data type not matched for integer and Date

sSQL = "INSERT INTO MANUFACTUREDGOODS(ENTRYDATE,DESCRIPTION,CETHNo ) VALUES( " ENTRYDATE " ,
' " & DESCRIPTION & " ', ' " & CETHNo & " ' )"

plz give me syntax for DATE and INTEGER data types.

ENTRYDATE = DATE FIELD
CETHNo= INTEGER FIELD

hoping positive
Nov 28 '06 #1
9 1401
NeoPa
32,556 Expert Mod 16PB
Expand|Select|Wrap|Line Numbers
  1. sSQL = "INSERT INTO MANUFACTUREDGOODS(ENTRYDATE,DESCRIPTION,CETHNo)" & _
  2.     "VALUES(#" & Format(ENTRYDATE,"m/d/yyyy") & _
  3.     "#,'" & DESCRIPTION & "'," & CETHNo & ")"
Dates should be formatted as M/D/YYYY and surrounded by "#" chars.
Strings should be surrounded by single-quote (') chars.
Numbers should be as they are without anything extra.
Nov 28 '06 #2
thank for your reply, it worked
but it is giving another ERROR: Too few parameters

sSQL = "INSERT INTO MANUFACTUREDGOODS
(ENTRYDATE,DESCRIPTION,CETHNo)" & _
"VALUES(#" & Format(ENTRYDATE, "m/d/yyyy") & _
"#,'" & DESCRIPTION & "'," & CETHNo & ")"

hoping answer



i'm trying to insert integer, string, date data types into a table, code is as below

Error: data type not matched for integer and Date

sSQL = "INSERT INTO MANUFACTUREDGOODS(ENTRYDATE,DESCRIPTION,CETHNo ) VALUES( " ENTRYDATE " ,
' " & DESCRIPTION & " ', ' " & CETHNo & " ' )"

plz give me syntax for DATE and INTEGER data types.

ENTRYDATE = DATE FIELD
CETHNo= INTEGER FIELD

hoping positive
Nov 29 '06 #3
I have created an ODBCMicrosoftAccessDriver of SystemDSN
but it is working first time only

second time it gives ERROR: run tmime error:2147467259(80004005)
Microsoft(ODBCMicrosoftAccessDriver)The database has been placed in a state unknown by an unknownuser that prevents it from being opened or locked.

give me solution

any other method other than system DSN

hoping positive
Nov 29 '06 #4
Killer42
8,435 Expert 8TB
...it worked but it is giving another ERROR: Too few parameters
Just to satisfy my curiosity, could you try pasting this code over the top of your existing one, just to see whether it makes any difference? (Making sure you have a copy of your own code, of course!)
Expand|Select|Wrap|Line Numbers
  1. sSQL = "INSERT INTO MANUFACTUREDGOODS (ENTRYDATE, DESCRIPTION, CETHNo)" & _
  2. " VALUES(#" & Format(ENTRYDATE, "m/d/yyyy") & _
  3. "#,'" & DESCRIPTION & "'," & CETHNo & ");"
  4.  
Plus, I have a question. We already know the format of the database fields. What are the formats of the variables you are concatenating here? One thing whichi occurs to me is that you could have an empty string or a Null in variable CETHNo, and maybe the database field requires a value.

One other thing - I don't know what the usual naming concentions are, but it might reduce confusion if you rename the variables slightly to differentiate between them and the database fields.
Nov 29 '06 #5
NeoPa
32,556 Expert Mod 16PB
Reported ?!? by OP :
i want to select data from a table, criteria is date

i used following code
but it is not working

DoCmd.OpenReport stDocName, acNormal, "Query1", DATE = "#SELECTDATE#"

hoping reply
Jan 2 '07 #6
Killer42
8,435 Expert 8TB
Reported ?!? by OP :
i want to select data from a table, criteria is date

i used following code
but it is not working

DoCmd.OpenReport stDocName, acNormal, "Query1", DATE = "#SELECTDATE#"

hoping reply
This is a bit of a confusing message, especially coming after such a long break in the thread. What's the story here? Anyway...

What does SELECTDATE represent? Is it supposed to cause Access to prompt the user for a date, or is it a variable name, or what?

In any case, the syntax of the fourth parameter in this statement looks completely wrong, to me. I'm surprised you didn't have something to say about it, NeoPa. I'm not that familiar with OpenReport, but the fourth parameter (wherecondition) is supposed to be a string expression, which the above is not.

I can think of a couple of possibilities to try...
Expand|Select|Wrap|Line Numbers
  1. DoCmd.OpenReport stDocName, acNormal, "Query1", "DATE = #" & SELECTDATE & "#"
  2. or
  3. DoCmd.OpenReport stDocName, acNormal, "Query1", "DATE = [SELECTDATE]"
  4.  
Can't guarantee either of them will work, though. Good luck!
Jan 2 '07 #7
NeoPa
32,556 Expert Mod 16PB
Killer,
I had nothing to do with this except to post the text that the OP had 'Reported'.
I had no real reason to comment - this is so far 'beyond' that I could see no benefit.
Jan 2 '07 #8
Killer42
8,435 Expert 8TB
Killer,
I had nothing to do with this except to post the text that the OP had 'Reported'.
I had no real reason to comment - this is so far 'beyond' that I could see no benefit.
Oh, now I get it! You mean the OP hit the "report" button instead of "reply".
Jan 2 '07 #9
NeoPa
32,556 Expert Mod 16PB
Yes - Hence the last line of my earlier post.
(He actually tried it twice.)
Jan 2 '07 #10

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

Similar topics

699
by: mike420 | last post by:
I think everyone who used Python will agree that its syntax is the best thing going for it. It is very readable and easy for everyone to learn. But, Python does not a have very good macro...
22
by: Tuang | last post by:
I'm checking out Python as a candidate for replacing Perl as my "Swiss Army knife" tool. The longer I can remember the syntax for performing a task, the more likely I am to use it on the spot if...
14
by: Sandy Norton | last post by:
If we are going to be stuck with @decorators for 2.4, then how about using blocks and indentation to elminate repetition and increase readability: Example 1 --------- class Klass: def...
16
by: George Sakkis | last post by:
I'm sure there must have been a past thread about this topic but I don't know how to find it: How about extending the "for <X> in" syntax so that X can include default arguments ? This would be very...
23
by: Carter Smith | last post by:
http://www.icarusindie.com/Literature/ebooks/ Rather than advocating wasting money on expensive books for beginners, here's my collection of ebooks that have been made freely available on-line...
19
by: Nicolas Fleury | last post by:
Hi everyone, I would to know what do you think of this PEP. Any comment welcomed (even about English mistakes). PEP: XXX Title: Specialization Syntax Version: $Revision: 1.10 $...
4
by: Jeremy Yallop | last post by:
Looking over some code I came across a line like this if isalnum((unsigned char)c) { which was accepted by the compiler without complaint. Should the compiler have issued a diagnostic in this...
177
by: C# Learner | last post by:
Why is C syntax so uneasy on the eye? In its day, was it _really_ designed by snobby programmers to scare away potential "n00bs"? If so, and after 50+ years of programming research, why are...
4
by: Bob hotmail.com> | last post by:
Everyone I have been spending weeks looking on the web for a good tutorial on how to use regular expressions and other methods to satisfy my craving for learning how to do FAST c-style syntax...
3
by: Manuel | last post by:
I'm trying to compile glut 3.7.6 (dowbloaded from official site)using devc++. So I've imported the glut32.dsp into devc++, included manually some headers, and start to compile. It return a very...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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
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.