473,406 Members | 2,867 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,406 software developers and data experts.

sql update statements over several lines in vb

29
I also wanted to know how to spread out sql statement over 3 lines.

I am writing an sql update statment in VB.

I have about 12 fields to update.

[code]
strSQL = "UPDATE [tblServiceUserPayments]" & _
"Set [tblServiceUserPayments].[January Payment] = DateSerial(Year(Date()),1,30), [tblServiceUserPayments].[JanPaymentRec] = False, [tblServiceUserPayments].[February Payment] = DateSerial(Year(Date()),2,28), [tblServiceUserPayments].[FebPaymentRec] = False " & _
"WHERE ((([tblServiceUserPayments].JanPaymentRec)= True) " & _
"AND (([tblServiceUserPayments].FebPaymentRec)= True));"
[code]

i have 10 more commands like that, and was wondering if it could be spreaded over several lines instead of one long line?
i have tried a few things, but they presented errors.
Apr 22 '07 #1
2 3058
Shokoth
29
If i put it in a different line, and put the word AND infront of it, the statement infront of the AND does not update, but the rest do

Is there any special characters that we need to use
Apr 23 '07 #2
MMcCarthy
14,534 Expert Mod 8TB
Try this ...

Expand|Select|Wrap|Line Numbers
  1. strSQL = "UPDATE [tblServiceUserPayments]" & _
  2. "Set [tblServiceUserPayments].[January Payment] = DateSerial(Year(Date()),1,30), " & _
  3. "[tblServiceUserPayments].[JanPaymentRec] = False, " & _
  4. "[tblServiceUserPayments].[February Payment] = DateSerial(Year(Date()),2,28), " & _
  5. "[tblServiceUserPayments].[FebPaymentRec] = False " & _
  6. "WHERE ((([tblServiceUserPayments].JanPaymentRec)= True) " & _
  7.   "AND (([tblServiceUserPayments].FebPaymentRec)= True));"
  8.  
Apr 25 '07 #3

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

Similar topics

2
by: Andreas Paasch | last post by:
I'm having a little problem here that seems difficult to solve - to me. I'm working on several tables at one time and once in a while I need to update them based on a previous select statement....
14
by: bolidev | last post by:
I'm new to SQL and can't figure out how to update my table (StoreItemStatus) that contains the current status for items in each store (STORE_KEY, ITEM_KEY, STATUS,...). I get updated status info...
8
by: Jan van Veldhuizen | last post by:
The UPDATE table FROM syntax is not supported by Oracle. I am looking for a syntax that is understood by both Oracle and SqlServer. Example: Table1: id name city ...
5
by: rdraider | last post by:
Hi all, I'm looking for a way to re-number inventory items. The items exist in 50+ tables, hundreds of fields and there are several thousand items. Maybe one table could hold the list of old &...
16
by: Philip Boonzaaier | last post by:
I want to be able to generate SQL statements that will go through a list of data, effectively row by row, enquire on the database if this exists in the selected table- If it exists, then the colums...
4
by: MaRcElO PeReIrA | last post by:
Hi there, I was in troubles with a UPDATE+IN statement: The following command use to take about 5 minutes to be done: UPDATE requisicao SET conclusao='3' WHERE reg IN (SELECT reg FROM...
4
by: Ed L. | last post by:
I think I'm seeing table-level lock contention in the following function when I have many different concurrent callers, each with mutually distinct values for $1. Is there a way to reimplement...
2
by: dba123 | last post by:
How do I take my GridView and create a function that will update -all- checkbox values for the submit button's OnClick event? I have posted both my SQLDataSource and my GridView below: ...
0
by: svgeorge | last post by:
I want to update several tables using one stored procedure. How can i do this I mean the syntax.etc. declaration etc. I know the basic syntax as below CREATE PROCEDURE <Procedure_Name, sysname,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
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...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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
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...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.