-
Feb 18th, 2005, 11:23 PM
#1
Thread Starter
Fanatic Member
SQL syntax [RESOLVED]
just wondering..
if i open table via recodset i can do something like this..
VB Code:
rs("qty") = rs("qty") - 1
if rs("qty") <= 0 then rs.delete
then what i ask is if i want to use UPDATE SQL..is there possible to do something like that?
thx for the input..
Last edited by erickwidya; Feb 20th, 2005 at 11:18 PM.
-
Feb 19th, 2005, 12:00 AM
#2
Re: SQL syntax
No need for a recordset. I think these will do what you asked. Execute on "TEST" table first.
Code:
UPDATE Table1 SET Qty = Qty - 1
DELETE FROM Table1 WHERE Qty <= 0
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum.
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it!
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6
-
Feb 20th, 2005, 10:23 PM
#3
Thread Starter
Fanatic Member
Re: SQL syntax
thx RobDog888 for the reply
try that at the query and it give me an error, maybe can't use more than one SQL statement at query?
PS :i forgot to tell u that i work with MS Access and want the syntax in one SQL statement
-
Feb 20th, 2005, 10:48 PM
#4
Re: SQL syntax
You can't execute two statements at once regardless of db type. You may, however, use transaction and if one of statements fails - Rollback everything that was done so your data will remain as it was prior to BeginTrans.
-
Feb 20th, 2005, 11:05 PM
#5
Re: SQL syntax
To elaborate on what RB posted.... You definately can't execute two sql statements
that perform a transaction and one is dependent on the other.
Why cant this be in a batch or two executions?
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum.
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it!
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6
-
Feb 20th, 2005, 11:17 PM
#6
Thread Starter
Fanatic Member
Re: SQL syntax
thx RobDog888 and RhinoBull
Why cant this be in a batch or two executions?
yes it can done via two executions, i'm just wonder if it can done just for one
well guess u guys have answered my question..
thx again
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|