Go statement

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

SQL Server has a Go function with which you can have more than one statement
run after each other. like updating a field and then directly after that,
updating another field that refers back the the first updated field. Thus
having one statement instead of two.
How can i do this in ACCES?
 
Hi Gunny

That is a bit dissapointing but thanks for the info. would programmatically
be by means of a macro?
 
Hi, Picasso.
would programmatically
be by means of a macro?

It could be, but I wouldn't recommend macros because they have no error
handling and don't offer much in customization capabilities. Instead,
create a module and then a procedure in that module. Inside the procedure,
use the following syntax for your queries:

Dim db As Database

Set db = CurrentDb()
db.Execute "UPDATE Schedule " & _
"SET StartDate = Date() " & _
"WHERE Course = 'SQL 101';", dbFailOnError

db.Execute "UPDATE Schedule " & _
"SET EndDate = Date() + 30" & _
"WHERE StartDate = Date();", dbFailOnError
Set db = Nothing

And add your error handling code, save, compile, and run the procedure.
Users won't be prompted that X number of records are about to be changed, so
you don't have to set warnings off, then back on again.

HTH.
Gunny

See http://www.QBuilt.com for all your database needs.
See http://www.Access.QBuilt.com for Microsoft Access tips and tutorials.
Blogs: www.DataDevilDog.BlogSpot.com, www.DatabaseTips.BlogSpot.com
http://www.Access.QBuilt.com/html/expert_contributors2.html for contact
info.
 
Wow looks hectic, never tried before but i'll give it a shot and i'm sure
i'll get it right.
thanks a mill
 
Back
Top