Newbie question on INSERT command

Newbie question on INSERT command

am 28.11.2007 03:56:41 von Jerry West

I'm using VB6 to create a new record in a Access db. I'm doing so like this:

INSERT INTO Customers (Name Prefix, First Name, Last Name, Name Suffix,
Company, Phone, Email, Address1, Addres2, City, State, Zip, Country) VALUES
('', 'Din W.', 'Cambell', '', '', '1 8055553128', notreal@bogus.net', '12345
Molkai Drive', '', 'Nowhere', 'SC', '19708', 'USA')

The error I get back indicates a syntax error. I've looked around at some
examples but I don't see where I'm going wrong. Could it be the empty
values?

Any insight much appreciated!

JW

Re: Newbie question on INSERT command

am 28.11.2007 04:43:40 von Wayne Gillespie

On Tue, 27 Nov 2007 18:56:41 -0800, "Jerry West" wrote:

>I'm using VB6 to create a new record in a Access db. I'm doing so like this:
>
>INSERT INTO Customers (Name Prefix, First Name, Last Name, Name Suffix,
>Company, Phone, Email, Address1, Addres2, City, State, Zip, Country) VALUES
>('', 'Din W.', 'Cambell', '', '', '1 8055553128', notreal@bogus.net', '12345
>Molkai Drive', '', 'Nowhere', 'SC', '19708', 'USA')
>
>The error I get back indicates a syntax error. I've looked around at some
>examples but I don't see where I'm going wrong. Could it be the empty
>values?
>
>Any insight much appreciated!
>
>JW
>

Use "" for empty values if you want to store them as a zero length string.

It is generally preferably to store empty values as NULL rather than a ZLS.

VALUES (NULL,'Din W.', 'Cambell', NULL , NULL , '1 8055553128', etc


Wayne Gillespie
Gosford NSW Australia

Re: Newbie question on INSERT command

am 28.11.2007 07:16:25 von lyle

On Nov 27, 9:56 pm, "Jerry West" wrote:
> I'm using VB6 to create a new record in a Access db. I'm doing so like this:
>
> INSERT INTO Customers (Name Prefix, First Name, Last Name, Name Suffix,
> Company, Phone, Email, Address1, Addres2, City, State, Zip, Country) VALUES
> ('', 'Din W.', 'Cambell', '', '', '1 8055553128', notr...@bogus.net', '12345
> Molkai Drive', '', 'Nowhere', 'SC', '19708', 'USA')
>
> The error I get back indicates a syntax error. I've looked around at some
> examples but I don't see where I'm going wrong. Could it be the empty
> values?
>
> Any insight much appreciated!
>
> JW

How about Addres2. Did you really spell Address1 and Addres2 so
differently?
How about , notr...@bogus.net'; clearly we have a single-quote
missing.

But really, it's a stretch for you to ask us to correct your syntax
when you post an example. How can we know if the errors we see are in
the example only, or in the actual code fragment?
The zero length strings may or may not be a problem, depending upon
how your fields are defined. In general, zero length strings can cause
high blood pressure, sweating, and inappropriate muttering I never
allow them.

Re: Newbie question on INSERT command

am 28.11.2007 23:38:52 von Bob Quintal

"Jerry West" wrote in
news:13kpm3g802jmo44@news.supernews.com:

> I'm using VB6 to create a new record in a Access db. I'm doing so
> like this:
>
> INSERT INTO Customers (Name Prefix, First Name, Last Name, Name
> Suffix, Company, Phone, Email, Address1, Addres2, City, State,
> Zip, Country) VALUES ('', 'Din W.', 'Cambell', '', '', '1
> 8055553128', notreal@bogus.net', '12345 Molkai Drive', '',
> 'Nowhere', 'SC', '19708', 'USA')
>
> The error I get back indicates a syntax error. I've looked around
> at some examples but I don't see where I'm going wrong. Could it
> be the empty values?
>
> Any insight much appreciated!
>
> JW
>
your problem stems from the names which have spaces in them.
Fix them by using square brackets [] around the full field name if
it contains ewmbedded spaces, or punctuation symbols.

INSERT INTO Customers ([Name Prefix], [First Name], [Last Name],


--
Bob Quintal

PA is y I've altered my email address.

--
Posted via a free Usenet account from http://www.teranews.com

Re: Newbie question on INSERT command

am 01.12.2007 01:56:21 von Jerry West

Thank you, that was the information I needed.

JW

"Bob Quintal" wrote in message
news:Xns99F6BC15E6435BQuintal@66.150.105.47...
> "Jerry West" wrote in
> news:13kpm3g802jmo44@news.supernews.com:
>
>> I'm using VB6 to create a new record in a Access db. I'm doing so
>> like this:
>>
>> INSERT INTO Customers (Name Prefix, First Name, Last Name, Name
>> Suffix, Company, Phone, Email, Address1, Addres2, City, State,
>> Zip, Country) VALUES ('', 'Din W.', 'Cambell', '', '', '1
>> 8055553128', notreal@bogus.net', '12345 Molkai Drive', '',
>> 'Nowhere', 'SC', '19708', 'USA')
>>
>> The error I get back indicates a syntax error. I've looked around
>> at some examples but I don't see where I'm going wrong. Could it
>> be the empty values?
>>
>> Any insight much appreciated!
>>
>> JW
>>
> your problem stems from the names which have spaces in them.
> Fix them by using square brackets [] around the full field name if
> it contains ewmbedded spaces, or punctuation symbols.
>
> INSERT INTO Customers ([Name Prefix], [First Name], [Last Name],
>
>
> --
> Bob Quintal
>
> PA is y I've altered my email address.
>
> --
> Posted via a free Usenet account from http://www.teranews.com
>