Query Issue

  • Thread starter Thread starter vbnetdev
  • Start date Start date
V

vbnetdev

The query below gets the error....

"Query1 is not a valid name. Make sure that it does not include invalid
characters or punctuation and that it is not too long."

Any ideas what is wrong? The field names and table names are right I have
checked many times.

UPDATE JERICHOSCHEDULE1 SET ['ROWID'] = 7, ['EVENTORG'] = 'Zion UCC',
EVENTORGLINK = 'http://www.zionucc.org', EVENTTITLE = 'Contemporary
Service', EVENTDESC = 'Jericho is very excited to play this event as some of
our band members have long standing relationships with this church. ',
EVENTDATE = 6/11/2006, EVENTSTARTTIME = '8:30AM', EVENTCITY = 'Sheboygan',
EVENTSTATE = 'WI', EVENTADDRESS = '1125 N. 6th St', EVENTORGLINKMAP =
'http://maps.google.com/maps?oi=map&q=1125+N+6th+St,+Sheboygan,+WI',
['EVENTSTATUS'] = 'CONFIRMED'
WHERE (([`ROWID`]=7));
 
Is this an Access/Jet query or a passthrough to another database? If it is
Access, try:
UPDATE JERICHOSCHEDULE1 SET [ROWID] = 7,
[EVENTORG] = 'Zion UCC',
EVENTORGLINK = 'http://www.zionucc.org',
EVENTTITLE = 'Contemporary Service',
EVENTDESC = 'Jericho is very excited to play this event as some of our
band members have long standing relationships with this church. ',
EVENTDATE = #6/11/2006#,
EVENTSTARTTIME = #8:30AM#,
EVENTCITY = 'Sheboygan',
EVENTSTATE = 'WI',
EVENTADDRESS = '1125 N. 6th St',
EVENTORGLINKMAP =
'http://maps.google.com/maps?oi=map&q=1125+N+6th+St,+Sheboygan,+WI',
[EVENTSTATUS] = 'CONFIRMED'
WHERE [ROWID]=7;
 
Do your field names actually contain apostrophes? That is, is the field
name EventOrg or is it 'EventOrg' including the apostrophes? Guessing that
they don't, I would remove the apostrophes.

I would use quote marks to delimit your text instead of apostrophes.
In addition, I would use # delimiters to identify the date and time fields
Why are you Updating ROWID to itself?

Of course all this is based on the assumption that you are using an Access
SQL (Access plus Jet).
UPDATE JERICHOSCHEDULE1
[EVENTORG] = "Zion UCC",
EVENTORGLINK = "http://www.zionucc.org",
EVENTTITLE = "Contemporary Service",
EVENTDESC = "Jericho is very excited to play this event as some of our band
members have long standing relationships with this church.",
EVENTDATE = #6/11/2006#,
EVENTSTARTTIME = #8:30AM#,
EVENTCITY = "Sheboygan",
EVENTSTATE = "WI",
EVENTADDRESS = "1125 N. 6th St",
EVENTORGLINKMAP =
"http://maps.google.com/maps?oi=map&q=1125+N+6th+St,+Sheboygan,+WI",
[EVENTSTATUS] = "CONFIRMED"
WHERE [ROWID]=7
 
Worked perfectly. Thank You!! Now what do you do when users put quotation
marks or ' things like that aroudn their words like say in the EVENTDESC
field? Also is there a way to make it save the time as 8:30 AM instead of
8:30:00 AM? It is of 'TEXT' variety.

I am goign to put the string in teh code I took away from your formatting on
teh chance you know what I am doing.

cmd9.CommandText = "UPDATE JERICHOSCHEDULE1 SET ROWID = " &
Me.US.SelectedRecordID & ", EVENTORG = '" & Me.tbOrganization.Text.ToString
& "', EVENTORGLINK = '" & Me.tbEventLinkWebSite.Text.ToString & "',
EVENTTITLE = '" & Me.tbEventTitle.Text.ToString & "', EVENTDESC = '" &
Me.tbEventDescription.Text.ToString & "', EVENTDATE = #" &
Me.clEventDate.SelectedDate.ToShortDateString & "#, EVENTSTARTTIME = #" &
Me.tbEventTime.Text.ToString & "#, EVENTCITY = '" &
Me.tbEventTitle.Text.ToString & "', EVENTSTATE = '" &
Me.tbEventTitle.Text.ToString & "', EVENTADDRESS = '" &
Me.tbEventAddress.Text.ToString & "', EVENTORGLINKMAP = '" &
Me.tbEventLinkMap.Text.ToString & "', EVENTSTATUS = '" &
Me.cbEventStatus.SelectedValue.ToString & "' WHERE [ROWID]=" &
Me.US.SelectedRecordID & ";"

--
Get a powerful web, database, application, and email hosting with KJM
Solutions
http://www.kjmsolutions.com



Duane Hookom said:
Is this an Access/Jet query or a passthrough to another database? If it is
Access, try:
UPDATE JERICHOSCHEDULE1 SET [ROWID] = 7,
[EVENTORG] = 'Zion UCC',
EVENTORGLINK = 'http://www.zionucc.org',
EVENTTITLE = 'Contemporary Service',
EVENTDESC = 'Jericho is very excited to play this event as some of our
band members have long standing relationships with this church. ',
EVENTDATE = #6/11/2006#,
EVENTSTARTTIME = #8:30AM#,
EVENTCITY = 'Sheboygan',
EVENTSTATE = 'WI',
EVENTADDRESS = '1125 N. 6th St',
EVENTORGLINKMAP =
'http://maps.google.com/maps?oi=map&q=1125+N+6th+St,+Sheboygan,+WI',
[EVENTSTATUS] = 'CONFIRMED'
WHERE [ROWID]=7;

--
Duane Hookom
Eau Claire - MS Access MVP
--

vbnetdev said:
The query below gets the error....

"Query1 is not a valid name. Make sure that it does not include invalid
characters or punctuation and that it is not too long."

Any ideas what is wrong? The field names and table names are right I have
checked many times.

UPDATE JERICHOSCHEDULE1 SET ['ROWID'] = 7, ['EVENTORG'] = 'Zion UCC',
EVENTORGLINK = 'http://www.zionucc.org', EVENTTITLE = 'Contemporary
Service', EVENTDESC = 'Jericho is very excited to play this event as some
of our band members have long standing relationships with this church. ',
EVENTDATE = 6/11/2006, EVENTSTARTTIME = '8:30AM', EVENTCITY =
'Sheboygan', EVENTSTATE = 'WI', EVENTADDRESS = '1125 N. 6th St',
EVENTORGLINKMAP =
'http://maps.google.com/maps?oi=map&q=1125+N+6th+St,+Sheboygan,+WI',
['EVENTSTATUS'] = 'CONFIRMED'
WHERE (([`ROWID`]=7));
 
The problem I am currently dealing is say in EVENTORG the name is St. Paul's
Lutheran. The ' sign is really makes the update bomb in that row. I tried
putting brackets around the field but it was unhappy iwth that too.

--
Get a powerful web, database, application, and email hosting with KJM
Solutions
http://www.kjmsolutions.com



vbnetdev said:
Worked perfectly. Thank You!! Now what do you do when users put quotation
marks or ' things like that aroudn their words like say in the EVENTDESC
field? Also is there a way to make it save the time as 8:30 AM instead of
8:30:00 AM? It is of 'TEXT' variety.

I am goign to put the string in teh code I took away from your formatting
on teh chance you know what I am doing.

cmd9.CommandText = "UPDATE JERICHOSCHEDULE1 SET ROWID = " &
Me.US.SelectedRecordID & ", EVENTORG = '" &
Me.tbOrganization.Text.ToString & "', EVENTORGLINK = '" &
Me.tbEventLinkWebSite.Text.ToString & "', EVENTTITLE = '" &
Me.tbEventTitle.Text.ToString & "', EVENTDESC = '" &
Me.tbEventDescription.Text.ToString & "', EVENTDATE = #" &
Me.clEventDate.SelectedDate.ToShortDateString & "#, EVENTSTARTTIME = #" &
Me.tbEventTime.Text.ToString & "#, EVENTCITY = '" &
Me.tbEventTitle.Text.ToString & "', EVENTSTATE = '" &
Me.tbEventTitle.Text.ToString & "', EVENTADDRESS = '" &
Me.tbEventAddress.Text.ToString & "', EVENTORGLINKMAP = '" &
Me.tbEventLinkMap.Text.ToString & "', EVENTSTATUS = '" &
Me.cbEventStatus.SelectedValue.ToString & "' WHERE [ROWID]=" &
Me.US.SelectedRecordID & ";"

--
Get a powerful web, database, application, and email hosting with KJM
Solutions
http://www.kjmsolutions.com



Duane Hookom said:
Is this an Access/Jet query or a passthrough to another database? If it
is Access, try:
UPDATE JERICHOSCHEDULE1 SET [ROWID] = 7,
[EVENTORG] = 'Zion UCC',
EVENTORGLINK = 'http://www.zionucc.org',
EVENTTITLE = 'Contemporary Service',
EVENTDESC = 'Jericho is very excited to play this event as some of our
band members have long standing relationships with this church. ',
EVENTDATE = #6/11/2006#,
EVENTSTARTTIME = #8:30AM#,
EVENTCITY = 'Sheboygan',
EVENTSTATE = 'WI',
EVENTADDRESS = '1125 N. 6th St',
EVENTORGLINKMAP =
'http://maps.google.com/maps?oi=map&q=1125+N+6th+St,+Sheboygan,+WI',
[EVENTSTATUS] = 'CONFIRMED'
WHERE [ROWID]=7;

--
Duane Hookom
Eau Claire - MS Access MVP
--

vbnetdev said:
The query below gets the error....

"Query1 is not a valid name. Make sure that it does not include invalid
characters or punctuation and that it is not too long."

Any ideas what is wrong? The field names and table names are right I
have checked many times.

UPDATE JERICHOSCHEDULE1 SET ['ROWID'] = 7, ['EVENTORG'] = 'Zion UCC',
EVENTORGLINK = 'http://www.zionucc.org', EVENTTITLE = 'Contemporary
Service', EVENTDESC = 'Jericho is very excited to play this event as
some of our band members have long standing relationships with this
church. ', EVENTDATE = 6/11/2006, EVENTSTARTTIME = '8:30AM', EVENTCITY =
'Sheboygan', EVENTSTATE = 'WI', EVENTADDRESS = '1125 N. 6th St',
EVENTORGLINKMAP =
'http://maps.google.com/maps?oi=map&q=1125+N+6th+St,+Sheboygan,+WI',
['EVENTSTATUS'] = 'CONFIRMED'
WHERE (([`ROWID`]=7));
 
I can't imagine you are hard-coding the values into sql statements and then
running them. You can double-up your single quotes or place double quotes
around the value to insert.

UPDATE JERICHOSCHEDULE1 SET [ROWID] = 7,
[EVENTORG] = 'Zion''s UCC',
EVENTORGLINK = 'http://www.zionucc.org',
EVENTTITLE = 'Contemporary Service',
EVENTDESC = "Jericho's chior is very excited to play this event as some of
our
band members have long standing relationships with this church. ",
EVENTDATE = #6/11/2006#,


--
Duane Hookom
MS Access MVP
--

vbnetdev said:
The problem I am currently dealing is say in EVENTORG the name is St.
Paul's Lutheran. The ' sign is really makes the update bomb in that row. I
tried putting brackets around the field but it was unhappy iwth that too.

--
Get a powerful web, database, application, and email hosting with KJM
Solutions
http://www.kjmsolutions.com



vbnetdev said:
Worked perfectly. Thank You!! Now what do you do when users put quotation
marks or ' things like that aroudn their words like say in the EVENTDESC
field? Also is there a way to make it save the time as 8:30 AM instead of
8:30:00 AM? It is of 'TEXT' variety.

I am goign to put the string in teh code I took away from your formatting
on teh chance you know what I am doing.

cmd9.CommandText = "UPDATE JERICHOSCHEDULE1 SET ROWID = " &
Me.US.SelectedRecordID & ", EVENTORG = '" &
Me.tbOrganization.Text.ToString & "', EVENTORGLINK = '" &
Me.tbEventLinkWebSite.Text.ToString & "', EVENTTITLE = '" &
Me.tbEventTitle.Text.ToString & "', EVENTDESC = '" &
Me.tbEventDescription.Text.ToString & "', EVENTDATE = #" &
Me.clEventDate.SelectedDate.ToShortDateString & "#, EVENTSTARTTIME = #" &
Me.tbEventTime.Text.ToString & "#, EVENTCITY = '" &
Me.tbEventTitle.Text.ToString & "', EVENTSTATE = '" &
Me.tbEventTitle.Text.ToString & "', EVENTADDRESS = '" &
Me.tbEventAddress.Text.ToString & "', EVENTORGLINKMAP = '" &
Me.tbEventLinkMap.Text.ToString & "', EVENTSTATUS = '" &
Me.cbEventStatus.SelectedValue.ToString & "' WHERE [ROWID]=" &
Me.US.SelectedRecordID & ";"

--
Get a powerful web, database, application, and email hosting with KJM
Solutions
http://www.kjmsolutions.com



Duane Hookom said:
Is this an Access/Jet query or a passthrough to another database? If it
is Access, try:
UPDATE JERICHOSCHEDULE1 SET [ROWID] = 7,
[EVENTORG] = 'Zion UCC',
EVENTORGLINK = 'http://www.zionucc.org',
EVENTTITLE = 'Contemporary Service',
EVENTDESC = 'Jericho is very excited to play this event as some of our
band members have long standing relationships with this church. ',
EVENTDATE = #6/11/2006#,
EVENTSTARTTIME = #8:30AM#,
EVENTCITY = 'Sheboygan',
EVENTSTATE = 'WI',
EVENTADDRESS = '1125 N. 6th St',
EVENTORGLINKMAP =
'http://maps.google.com/maps?oi=map&q=1125+N+6th+St,+Sheboygan,+WI',
[EVENTSTATUS] = 'CONFIRMED'
WHERE [ROWID]=7;

--
Duane Hookom
Eau Claire - MS Access MVP
--

The query below gets the error....

"Query1 is not a valid name. Make sure that it does not include invalid
characters or punctuation and that it is not too long."

Any ideas what is wrong? The field names and table names are right I
have checked many times.

UPDATE JERICHOSCHEDULE1 SET ['ROWID'] = 7, ['EVENTORG'] = 'Zion UCC',
EVENTORGLINK = 'http://www.zionucc.org', EVENTTITLE = 'Contemporary
Service', EVENTDESC = 'Jericho is very excited to play this event as
some of our band members have long standing relationships with this
church. ', EVENTDATE = 6/11/2006, EVENTSTARTTIME = '8:30AM', EVENTCITY
= 'Sheboygan', EVENTSTATE = 'WI', EVENTADDRESS = '1125 N. 6th St',
EVENTORGLINKMAP =
'http://maps.google.com/maps?oi=map&q=1125+N+6th+St,+Sheboygan,+WI',
['EVENTSTATUS'] = 'CONFIRMED'
WHERE (([`ROWID`]=7));
 
Back
Top